From a2e32839cc2d45b6f8f559061ac4315acc628396 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 6 May 2014 16:13:36 -0400 Subject: [PATCH] Bug fixes from running Coverity --- impatomic.cc | 12 ++++++++---- main.cc | 6 +++--- model.cc | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/impatomic.cc b/impatomic.cc index 2d48989..4b5d1c2 100644 --- a/impatomic.cc +++ b/impatomic.cc @@ -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 --- 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 */ }; diff --git a/model.cc b/model.cc index e7c48ed..72a8d13 100644 --- a/model.cc +++ b/model.cc @@ -2,6 +2,7 @@ #include #include #include +#include #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 */ -- 2.34.1