From 698a907441af5d03d52dc8b253e665a726f88930 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 2 Jul 2019 10:33:04 -0700 Subject: [PATCH] bug fix --- execution.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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; -- 2.34.1