[commit: ghc] master: rts: Turn ASSERT in LDV_recordDead into a normal if (9b65ae6)

git at git.haskell.org git at git.haskell.org
Tue Dec 25 16:19:42 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/9b65ae69fbeddcb9df7c70b71c9cf62be1e03dbd/ghc

>---------------------------------------------------------------

commit 9b65ae69fbeddcb9df7c70b71c9cf62be1e03dbd
Author: Ben Gamari <ben at smart-cactus.org>
Date:   Sat Dec 22 19:43:41 2018 -0500

    rts: Turn ASSERT in LDV_recordDead into a normal if
    
    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.


>---------------------------------------------------------------

9b65ae69fbeddcb9df7c70b71c9cf62be1e03dbd
 rts/ProfHeap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rts/ProfHeap.c b/rts/ProfHeap.c
index 517702f..9ab4ff1 100644
--- a/rts/ProfHeap.c
+++ b/rts/ProfHeap.c
@@ -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) {



More information about the ghc-commits mailing list