Bug fixes from running Coverity
authorbdemsky <bdemsky@uci.edu>
Tue, 6 May 2014 20:13:36 +0000 (16:13 -0400)
committerbdemsky <bdemsky@uci.edu>
Tue, 6 May 2014 20:13:36 +0000 (16:13 -0400)
impatomic.cc
main.cc
model.cc

index 2d48989..4b5d1c2 100644 (file)
@@ -26,11 +26,15 @@ void atomic_flag_clear_explicit
 void atomic_flag_clear( volatile atomic_flag* __a__ )
 { atomic_flag_clear_explicit( __a__, memory_order_seq_cst ); }
 
-void __atomic_flag_wait__( volatile atomic_flag* __a__ )
-{ while ( atomic_flag_test_and_set( __a__ ) ); }
+void __atomic_flag_wait__( volatile atomic_flag* __a__ ) { 
+       while ( atomic_flag_test_and_set( __a__ ) )
+               ; 
+}
 
 void __atomic_flag_wait_explicit__( volatile atomic_flag* __a__,
-                                    memory_order __x__ )
-{ while ( atomic_flag_test_and_set_explicit( __a__, __x__ ) ); }
+                                    memory_order __x__ ) {
+       while ( atomic_flag_test_and_set_explicit( __a__, __x__ ))
+               ;
+}
 
 }
diff --git a/main.cc b/main.cc
index 127ffd1..c93c5e9 100644 (file)
--- a/main.cc
+++ b/main.cc
@@ -141,9 +141,9 @@ static void parse_options(struct model_params *params, int argc, char **argv)
                {"enabled", required_argument, NULL, 'e'},
                {"bound", required_argument, NULL, 'b'},
                {"verbose", optional_argument, NULL, 'v'},
-               {"uninitialized", optional_argument, NULL, 'u'},
-               {"analysis", optional_argument, NULL, 't'},
-               {"options", optional_argument, NULL, 'o'},
+               {"uninitialized", required_argument, NULL, 'u'},
+               {"analysis", required_argument, NULL, 't'},
+               {"options", required_argument, NULL, 'o'},
                {"maxexecutions", required_argument, NULL, 'x'},
                {0, 0, 0, 0} /* Terminator */
        };
index e7c48ed..72a8d13 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -2,6 +2,7 @@
 #include <algorithm>
 #include <new>
 #include <stdarg.h>
+#include <string.h>
 
 #include "model.h"
 #include "action.h"
@@ -30,6 +31,7 @@ ModelChecker::ModelChecker(struct model_params params) :
        earliest_diverge(NULL),
        trace_analyses()
 {
+       memset(&stats,0,sizeof(struct execution_stats));
 }
 
 /** @brief Destructor */