summaryrefslogtreecommitdiff
path: root/rts/Interpreter.c
diff options
context:
space:
mode:
authorDavid Feuer <david.feuer@gmail.com>2017-09-17 00:21:03 -0400
committerDavid Feuer <David.Feuer@gmail.com>2017-09-17 00:21:03 -0400
commit60a3f11ff4b7e239a273498812fd9d31f6775726 (patch)
treeb1d837036d53f3ce6e6e6bede49f904800b57ed3 /rts/Interpreter.c
parent4ec4ca999ac558e1678b0a609417de5bf08c3ad5 (diff)
downloadhaskell-60a3f11ff4b7e239a273498812fd9d31f6775726.tar.gz
Fix pointer tagging mistake
f9c6d53fe997f1c560cda6f346f4b201711df37c led to #14036. The problem turned out to be rather simple: the `obj` pointer was being tagged using `obj + arity`. Because this is C, that's done with *pointer arithmetic*, which is not at all what we want. Add appropriate casts. Reviewers: austin, bgamari, erikd, simonmar Reviewed By: bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14036 Differential Revision: https://phabricator.haskell.org/D3983
Diffstat (limited to 'rts/Interpreter.c')
-rw-r--r--rts/Interpreter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index f3a6cb53b8..165511b24c 100644
--- a/rts/Interpreter.c
+++ b/rts/Interpreter.c
@@ -429,7 +429,9 @@ eval_obj:
// https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/PointerTagging
tagged_obj =
newEmptyPAP(cap,
- arity <= TAG_MASK ? obj + arity : obj,
+ arity <= TAG_MASK
+ ? (StgClosure *) ((intptr_t) obj + arity)
+ : obj,
arity);
}
#endif