summaryrefslogtreecommitdiff
path: root/rts/Messages.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2010-06-10 08:06:36 +0000
committerSimon Marlow <marlowsd@gmail.com>2010-06-10 08:06:36 +0000
commit565f3c753ccedeb19b5b8190090241a2185eb0cb (patch)
tree9396ad7223765464ccd7071209ef2e4e2faf39ab /rts/Messages.c
parent5ac6359ebd27b7a84eb63a3ea779d9ce6659ce76 (diff)
downloadhaskell-565f3c753ccedeb19b5b8190090241a2185eb0cb.tar.gz
messageBlackHole: fix deadlock bug caused by a missing 'volatile'
Diffstat (limited to 'rts/Messages.c')
-rw-r--r--rts/Messages.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/Messages.c b/rts/Messages.c
index 91ee9a6574..7a37a86259 100644
--- a/rts/Messages.c
+++ b/rts/Messages.c
@@ -186,7 +186,9 @@ nat messageBlackHole(Capability *cap, MessageBlackHole *msg)
// The blackhole must indirect to a TSO, a BLOCKING_QUEUE, an IND,
// or a value.
loop:
- p = UNTAG_CLOSURE(((StgInd*)bh)->indirectee);
+ // NB. VOLATILE_LOAD(), because otherwise gcc hoists the load
+ // and turns this into an infinite loop.
+ p = UNTAG_CLOSURE((StgClosure*)VOLATILE_LOAD(&((StgInd*)bh)->indirectee));
info = p->header.info;
if (info == &stg_IND_info)