BangPatterns-related behavior regressions on GHC 8.0
When you compile this code:
{-# LANGUAGE BangPatterns #-}
main :: IO ()
main = let !_ = (undefined :: ()) in print 2
with GHC 8.0.1-rc2 with any level of optimizations, it will print 2
instead of throwing undefined
like GHC 7.10.3 does.
Note that changing undefined :: ()
to something like undefined :: Int#
is enough to invoke undefined
when compiled, but if you run this code in GHCi:
λ> :set -XMagicHash -XBangPatterns
λ> import GHC.Prim
λ> let !_ = (undefined :: Int#) in print 2
You get something even stranger:
ghc: panic! (the 'impossible' happened)
(GHC version 8.0.0.20160204 for x86_64-unknown-linux):
dsLet: unlifted
!_ = (undefined :: Int#)
print @ Integer $dShow_a2ky 2
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1-rc2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |