rts: Turn ASSERT in LDV_recordDead into a normal if
authorBen Gamari <ben@smart-cactus.org>
Sun, 23 Dec 2018 00:43:41 +0000 (19:43 -0500)
committerBen Gamari <ben@well-typed.com>
Tue, 25 Dec 2018 16:18:52 +0000 (11:18 -0500)
As reported in #15382 the `ASSERT(ctr != NULL)` is currently getting routinely
hit during testsuite runs. While this is certainly a bug I would far prefer
getting a proper error message than a segmentation fault. Consequently I'm
turning the `ASSERT` into a proper `if` so we get a proper error in non-debug
builds.

rts/ProfHeap.c

index 517702f..9ab4ff1 100644 (file)
@@ -201,7 +201,9 @@ LDV_recordDead( const StgClosure *c, uint32_t size )
                 } else {
                     id = closureIdentity(c);
                     ctr = lookupHashTable(censuses[t].hash, (StgWord)id);
-                    ASSERT( ctr != NULL );
+                    if (ctr == NULL)
+                        barf("LDV_recordDead: Failed to find counter for closure %p", c);
+
                     ctr->c.ldv.void_total += size;
                     ctr = lookupHashTable(censuses[era].hash, (StgWord)id);
                     if (ctr == NULL) {