Fix LOOKS_LIKE_PTR for 64-bit platforms
authorReid Barton <rwbarton@gmail.com>
Mon, 1 Feb 2016 13:32:38 +0000 (14:32 +0100)
committerBen Gamari <ben@smart-cactus.org>
Mon, 1 Feb 2016 13:32:50 +0000 (14:32 +0100)
I'm not sure what this is used for. But it won't correctly
detect RTS-filled slop on 64-bit platforms.

Test Plan:
Untested. But I did verify that

    unsigned long x = (unsigned long)0xaaaaaaaaaaaaaaaaULL;

compiles warning-free and produces the expected output using both
gcc and clang, with -Wall -Wextra -O, and with and without -m32.

Reviewers: simonmar, austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1860

rts/RetainerProfile.c

index 7a1a661..6a6a542 100644 (file)
@@ -2063,7 +2063,7 @@ retainerProfile(void)
 
 #define LOOKS_LIKE_PTR(r) ((LOOKS_LIKE_STATIC_CLOSURE(r) || \
         ((HEAP_ALLOCED(r) && ((Bdescr((P_)r)->flags & BF_FREE) == 0)))) && \
 
 #define LOOKS_LIKE_PTR(r) ((LOOKS_LIKE_STATIC_CLOSURE(r) || \
         ((HEAP_ALLOCED(r) && ((Bdescr((P_)r)->flags & BF_FREE) == 0)))) && \
-        ((StgWord)(*(StgPtr)r)!=0xaaaaaaaa))
+        ((StgWord)(*(StgPtr)r)!=(StgWord)0xaaaaaaaaaaaaaaaaULL))
 
 static nat
 sanityCheckHeapClosure( StgClosure *c )
 
 static nat
 sanityCheckHeapClosure( StgClosure *c )