[commit: ghc] master: Fix C macro bug that was causing some stack checks to erroneously succeed (984149b)

Simon Marlow <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/984149bf8845dd897e038943b6177ae4fb184591

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

commit 984149bf8845dd897e038943b6177ae4fb184591
Author: Simon Marlow <[email protected]>
Date:   Wed Oct 31 11:18:36 2012 +0000

    Fix C macro bug that was causing some stack checks to erroneously succeed

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

 includes/Cmm.h |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/includes/Cmm.h b/includes/Cmm.h
index 211d2a8..5ef6c2d 100644
--- a/includes/Cmm.h
+++ b/includes/Cmm.h
@@ -372,8 +372,8 @@
    CCCS_ALLOC(bytes);
 
 #define HEAP_CHECK(bytes,failure)                       \
-    Hp = Hp + bytes;                                    \
-    if (Hp > HpLim) { HpAlloc = bytes; failure; }       \
+    Hp = Hp + (bytes);                                  \
+    if (Hp > HpLim) { HpAlloc = (bytes); failure; }     \
     TICK_ALLOC_HEAP_NOCTR(bytes);
 
 #define ALLOC_PRIM_WITH_CUSTOM_FAILURE(bytes,failure)           \
@@ -400,8 +400,8 @@
 #define HP_CHK_P(bytes, fun, arg)               \
    HEAP_CHECK(bytes, GC_PRIM_P(fun,arg))
 
-#define ALLOC_P_TICKY(alloc, fun, arg)         \
-   HP_CHK_P(alloc);                           \
+#define ALLOC_P_TICKY(alloc, fun, arg)          \
+   HP_CHK_P(alloc);                             \
    TICK_ALLOC_HEAP_NOCTR(alloc);
 
 #define CHECK_GC()                                                      \
@@ -473,22 +473,22 @@
    }
 
 #define STK_CHK(n, fun)                         \
-    if (Sp - n < SpLim) {                       \
+    if (Sp - (n) < SpLim) {                     \
         GC_PRIM(fun)                            \
     }
 
 #define STK_CHK_P(n, fun, arg)                  \
-    if (Sp - n < SpLim) {                       \
+    if (Sp - (n) < SpLim) {                     \
         GC_PRIM_P(fun,arg)                      \
     }
 
 #define STK_CHK_PP(n, fun, arg1, arg2)          \
-    if (Sp - n < SpLim) {                       \
+    if (Sp - (n) < SpLim) {                     \
         GC_PRIM_PP(fun,arg1,arg2)               \
     }
 
 #define STK_CHK_ENTER(n, closure)               \
-    if (Sp - n < SpLim) {                       \
+    if (Sp - (n) < SpLim) {                     \
         jump __stg_gc_enter_1(closure);         \
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.