From: root Date: Wed, 31 Jul 2019 01:48:04 +0000 (-0700) Subject: bug fixes X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=commitdiff_plain;h=66a81d85cc79168151a315b33ba9500c12d199d7 bug fixes --- diff --git a/execution.cc b/execution.cc index cfb0b0bc..50e052a1 100644 --- a/execution.cc +++ b/execution.cc @@ -1104,8 +1104,9 @@ void ModelExecution::add_action_to_lists(ModelAction *act) if (uninit_id >= (int)vec->size()) { int oldsize = (int) vec->size(); vec->resize(uninit_id + 1); - for(int i=oldsize;isize(); vec->resize(priv->next_thread_id); for(uint i=oldsize;inext_thread_id;i++) - new (&vec[i]) action_list_t(); + new (&(*vec)[i]) action_list_t(); } (*vec)[tid].push_back(act); if (uninit) @@ -1151,7 +1152,7 @@ void ModelExecution::add_action_to_lists(ModelAction *act) uint oldsize = vec->size(); vec->resize(priv->next_thread_id); for(uint i=oldsize;inext_thread_id;i++) - new (&vec[i]) action_list_t(); + new (&(*vec)[i]) action_list_t(); } (*vec)[tid].push_back(act); } @@ -1213,7 +1214,7 @@ void ModelExecution::add_normal_write_to_lists(ModelAction *act) uint oldsize =vec->size(); vec->resize(priv->next_thread_id); for(uint i=oldsize;inext_thread_id;i++) - new (&vec[i]) action_list_t(); + new (&(*vec)[i]) action_list_t(); } insertIntoActionList(&(*vec)[tid],act); @@ -1230,7 +1231,7 @@ void ModelExecution::add_write_to_lists(ModelAction *write) { uint oldsize =vec->size(); vec->resize(priv->next_thread_id); for(uint i=oldsize;inext_thread_id;i++) - new (&vec[i]) action_list_t(); + new (&(*vec)[i]) action_list_t(); } (*vec)[tid].push_back(write); } diff --git a/history.cc b/history.cc index b1516913..ea4ce20b 100644 --- a/history.cc +++ b/history.cc @@ -26,7 +26,11 @@ void ModelHistory::enter_function(const uint32_t func_id, thread_id_t tid) thrd_func_inst_lists = model->get_execution()->get_thrd_func_inst_lists(); if ( thrd_func_list->size() <= id ) { - thrd_func_list->resize( id + 1 ); + uint oldsize = thrd_func_list->size(); + thrd_func_list->resize( id + 1 ); + for(uint i=oldsize; iresize( id + 1 ); } diff --git a/stl-model.h b/stl-model.h index 489939b7..74aaee69 100644 --- a/stl-model.h +++ b/stl-model.h @@ -59,15 +59,21 @@ public: void pop_front() { mllnode<_Tp> *tmp = head; head = head->next; - head->prev = NULL; + if (head == NULL) + tail = NULL; + else + head->prev = NULL; delete tmp; _size--; } void pop_back() { mllnode<_Tp> *tmp = tail; - tail = tail->next; - tail->next = NULL; + tail = tail->prev; + if (tail == NULL) + head = NULL; + else + tail->next = NULL; delete tmp; _size--; } @@ -211,15 +217,21 @@ public: void pop_front() { sllnode<_Tp> *tmp = head; head = head->next; - head->prev = NULL; + if (head == NULL) + tail = NULL; + else + head->prev = NULL; delete tmp; _size--; } void pop_back() { sllnode<_Tp> *tmp = tail; - tail = tail->next; - tail->next = NULL; + tail = tail->prev; + if (tail == NULL) + head = NULL; + else + tail->next = NULL; delete tmp; _size--; } @@ -358,11 +370,11 @@ public: array[_size++] = item; } - type operator[](uint index) const { + type operator[](int index) const { return array[index]; } - type & operator[](uint index) { + type & operator[](int index) { return array[index]; } @@ -463,11 +475,11 @@ public: array[_size++] = item; } - type & operator[](uint index) { + type operator[](int index) const { return array[index]; } - type operator[](uint index) const { + type & operator[](int index) { return array[index]; }