fix norris bugs
authorBrian Demsky <bdemsky@uci.edu>
Fri, 2 Nov 2012 08:11:40 +0000 (01:11 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Fri, 2 Nov 2012 08:11:40 +0000 (01:11 -0700)
model.cc
nodestack.cc
nodestack.h

index 7181f86977688054159da03d0c3a7921ce23c958..2fa54d6e9ba1e76be577ec0625f6138ee7d1c5d4 100644 (file)
--- a/model.cc
+++ b/model.cc
@@ -383,6 +383,10 @@ void ModelChecker::set_backtracking(ModelAction *act)
        for(int i = low_tid; i < high_tid; i++) {
                thread_id_t tid = int_to_id(i);
 
+               /* Make sure this thread can be enabled here. */
+               if (i >= node->get_num_threads())
+                       break;
+
                /* Don't backtrack into a point where the thread is disabled or sleeping. */
                if (node->get_enabled_array()[i]!=THREAD_ENABLED)
                        continue;
index 06259b91c54964ba4c094af50347c11a23d9cb41..23e87ac690a79c334da6a9f8ed85a269ce073116 100644 (file)
@@ -262,6 +262,7 @@ void Node::explore_child(ModelAction *act, enabled_type_t * is_enabled)
 bool Node::set_backtrack(thread_id_t id)
 {
        int i = id_to_int(id);
+       ASSERT(i<((int)backtrack.size()));
        if (backtrack[i])
                return false;
        backtrack[i] = true;
@@ -429,6 +430,7 @@ bool Node::relseq_break_empty() {
 void Node::explore(thread_id_t tid)
 {
        int i = id_to_int(tid);
+       ASSERT(i<((int)backtrack.size()));
        if (backtrack[i]) {
                backtrack[i] = false;
                numBacktracks--;
index 1dfccfcb7b9cc268d7cfab5b3aada4df8205b4d7..10331c2ef59ccb00046ad62c3e40439543a1288d 100644 (file)
@@ -53,7 +53,7 @@ struct fairness_info {
  */
 class Node {
 public:
-       Node(ModelAction *act = NULL, Node *par = NULL, int nthreads = 1, Node *prevfairness = NULL);
+       Node(ModelAction *act = NULL, Node *par = NULL, int nthreads = 2, Node *prevfairness = NULL);
        ~Node();
        /* return true = thread choice has already been explored */
        bool has_been_explored(thread_id_t tid);