model: bugfix - resize thrd_last_action when adding objects
authorBrian Norris <banorris@uci.edu>
Thu, 12 Jul 2012 18:05:20 +0000 (11:05 -0700)
committerBrian Norris <banorris@uci.edu>
Thu, 12 Jul 2012 18:05:20 +0000 (11:05 -0700)
Apparently, STL vectors don't resize automatically, nor do they warn or print
errors when you access them out-of-bounds...

model.cc

index e579105..cde6213 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -291,6 +291,8 @@ void ModelChecker::add_action_to_lists(ModelAction *act)
                vec->resize(next_thread_id);
        (*vec)[tid].push_back(act);
 
+       if ((int)thrd_last_action->size() <= tid)
+               thrd_last_action->resize(get_num_threads());
        (*thrd_last_action)[tid] = act;
 }