From: bdemsky Date: Mon, 15 Jul 2019 22:00:09 +0000 (-0700) Subject: add asserts X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=160e1a57d91fb3b9217bad5a31b498fdc4c426b8;p=c11tester.git add asserts --- diff --git a/datarace.cc b/datarace.cc index 9ba59399..ac86efc1 100644 --- a/datarace.cc +++ b/datarace.cc @@ -96,6 +96,7 @@ static void expandRecord(uint64_t *shadow) record->thread = (thread_id_t *)snapshot_malloc(sizeof(thread_id_t) * record->capacity); record->readClock = (modelclock_t *)snapshot_malloc(sizeof(modelclock_t) * record->capacity); record->numReads = 1; + ASSERT(readThread >= 0); record->thread[0] = readThread; record->readClock[0] = readClock; } @@ -284,6 +285,7 @@ void fullRaceCheckRead(thread_id_t thread, const void *location, uint64_t *shado if (clock_may_race(currClock, thread, readClock, readThread)) { /* Still need this read in vector */ if (copytoindex != i) { + ASSERT(record->thread[i] >= 0); record->readClock[copytoindex] = record->readClock[i]; record->thread[copytoindex] = record->thread[i]; } @@ -306,6 +308,7 @@ void fullRaceCheckRead(thread_id_t thread, const void *location, uint64_t *shado modelclock_t ourClock = currClock->getClock(thread); + ASSERT(thread >= 0); record->thread[copytoindex] = thread; record->readClock[copytoindex] = ourClock; record->numReads = copytoindex + 1;