[commit: ghc] master: Fix pointer tagging mistake (60a3f11)

git at git.haskell.org git at git.haskell.org
Sun Sep 17 04:19:37 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/60a3f11ff4b7e239a273498812fd9d31f6775726/ghc

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

commit 60a3f11ff4b7e239a273498812fd9d31f6775726
Author: David Feuer <david.feuer at gmail.com>
Date:   Sun Sep 17 00:21:03 2017 -0400

    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


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

60a3f11ff4b7e239a273498812fd9d31f6775726
 rts/Interpreter.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/rts/Interpreter.c b/rts/Interpreter.c
index f3a6cb5..165511b 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



More information about the ghc-commits mailing list