From 04ffc0dafb0bfa78aa73b21359ca5b53622e675d Mon Sep 17 00:00:00 2001
From: root <root@dw-6.eecs.uci.edu>
Date: Thu, 25 Jul 2019 13:59:59 -0700
Subject: [PATCH] Bug fixes to atomic logic

---
 execution.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/execution.cc b/execution.cc
index 0710dd6b..af54b54a 100644
--- a/execution.cc
+++ b/execution.cc
@@ -596,8 +596,8 @@ bool ModelExecution::process_fence(ModelAction *curr)
 				continue;
 
 			/* Establish hypothetical release sequences */
-			ClockVector *cv = get_hb_from_write(act);
-			if (curr->get_cv()->merge(cv))
+			ClockVector *cv = get_hb_from_write(act->get_reads_from());
+			if (cv != NULL && curr->get_cv()->merge(cv))
 				updated = true;
 		}
 	}
@@ -987,7 +987,7 @@ bool ModelExecution::r_modification_order(ModelAction *curr, const ModelAction *
 			if (act->happens_before(curr)) {
 				if (i==0) {
 					if (last_sc_fence_local == NULL ||
-							(*last_sc_fence_local < *prev_same_thread)) {
+							(*last_sc_fence_local < *act)) {
 						prev_same_thread = act;
 					}
 				}
-- 
2.34.1