From bb18310b8c8c97d8e396940bdfee740bd6d3e30a Mon Sep 17 00:00:00 2001 From: weiyu Date: Sun, 10 Nov 2019 13:55:25 -0800 Subject: [PATCH] Avoid seg fault in the case where ensureModel is called in cds_func_entry and then a normal memory access comes before first recorded ModelAction --- datarace.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/datarace.cc b/datarace.cc index 58c52dd6..dd88c2fe 100644 --- a/datarace.cc +++ b/datarace.cc @@ -256,6 +256,9 @@ void raceCheckWrite(thread_id_t thread, void *location) uint64_t *shadow = lookupAddressEntry(location); uint64_t shadowval = *shadow; ClockVector *currClock = get_execution()->get_cv(thread); + if (currClock == NULL) + return; + struct DataRace * race = NULL; /* Do full record */ if (shadowval != 0 && !ISSHORTRECORD(shadowval)) { @@ -424,6 +427,9 @@ void raceCheckRead(thread_id_t thread, const void *location) uint64_t *shadow = lookupAddressEntry(location); uint64_t shadowval = *shadow; ClockVector *currClock = get_execution()->get_cv(thread); + if (currClock == NULL) + return; + struct DataRace * race = NULL; /* Do full record */ -- 2.34.1