
#14677: Code generator does not correctly tag a pointer -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Resolution: | Keywords: CodeGen Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: 15155 | Blocking: 14626 Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by heisenbug): We will probably not be able to restore the invariant for all cases. Here is a curious case {{{#!hs module A where newtype A = A Int num :: Int num = 42 {-# NOINLINE a #-} a = A num }}} {{{#!hs module Main where import A data T = MkT A t = MkT a }}} In the absence of your patch `MkT` gets passed an untagged pointer, because the unfolding of `a` is wrongly interpreted. GHC should be able to know that `a` has the `I#` constructor. **Your patch improves on the situation.** `MkT` now gets passed a tagged pointer. BUT: when the pointee `a` is an IND_STATIC closure (in the above case it is), we get incorrect behaviour, as the closure has the wrong layout and wants to be ''entered''. #15155 recovers correctness. I don't really care about the bang invariant. What I care is that GHC is not coerced into deliberately throwing away perfectly good hints (leading to suboptimal tagging) because of the IND_STATIC hack. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14677#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler