From: root Date: Tue, 2 Jul 2019 17:33:04 +0000 (-0700) Subject: bug fix X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=698a907441af5d03d52dc8b253e665a726f88930;p=c11tester.git bug fix --- diff --git a/execution.cc b/execution.cc index 40b83e05..e3a0a855 100644 --- a/execution.cc +++ b/execution.cc @@ -1019,20 +1019,20 @@ bool ModelExecution::mo_may_allow(const ModelAction *writer, const ModelAction * */ ClockVector * ModelExecution::get_hb_from_write(ModelAction *rf) const { - SnapVector * processset = NULL; + SnapVector * processset = NULL; for ( ;rf != NULL;rf = rf->get_reads_from()) { ASSERT(rf->is_write()); if (!rf->is_rmw() || (rf->is_acquire() && rf->is_release()) || rf->get_rfcv() != NULL) break; if (processset == NULL) - processset = new SnapVector(); + processset = new SnapVector(); processset->push_back(rf); } - int i = (processset == NULL) ? 1 : processset->size(); + int i = (processset == NULL) ? 0 : processset->size(); ClockVector * vec = NULL; - for(;i > 0 ;i--) { + while(true) { if (rf->get_rfcv() != NULL) { vec = rf->get_rfcv(); } else if (rf->is_acquire() && rf->is_release()) { @@ -1053,6 +1053,11 @@ ClockVector * ModelExecution::get_hb_from_write(ModelAction *rf) const { } rf->set_rfcv(vec); } + i--; + if (i >= 0) { + rf = (*processset)[i]; + } else + break; } if (processset != NULL) delete processset;