GHC panic encountered for unlifted let bindings
The following code block makes GHC panic:
{-# LANGUAGE BangPatterns #-}
module GhcPanic where
import GHC.Ptr
import Foreign
-- Occurred in a really low-level bytestring decoder implementation.
{-# INLINE byteStringSlice #-}
byteStringSlice len = \fpbuf ip0 ipe s0 ->
let ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len
-- Note that the panic goes away if we use a bang-pattern as follows
-- let !ip1p@(Ptr ip1) = Ptr ip0 `plusPtr` len
in ip1p
The panic output is
ghc-7.4.1 GhcPanic.hs
[1 of 1] Compiling GhcPanic ( GhcPanic.hs, GhcPanic.o )
ghc: panic! (the 'impossible' happened)
(GHC version 7.4.1 for x86_64-unknown-linux):
dsLet: unlifted
AbsBinds
[( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )]
[]
[( ip1p{v acI} [lid] :: forall ( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ).
base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ) ) <= ( ip1p{v acK} [lid] :: base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ) )
/\(@ ( t{tv acW} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )).
(<>) @ ( t{tv acW} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ),
( ip1{v acJ} [lid] :: ghc-prim:GHC.Prim.Addr#{(w) tc 33} ) <= ( ip1{v acP} [lid] :: ghc-prim:GHC.Prim.Addr#{(w) tc 33} )
(<>)
@ (ghc-prim:GHC.Prim.Any{(w) tc 31N}
ghc-prim:GHC.Prim.*{(w) tc 34d})]
( ip1p{v acI} [lid] :: forall ( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ).
base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ) )
:: forall ( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ).
base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )
[LclId]
( ip1{v acJ} [lid] :: ghc-prim:GHC.Prim.Addr#{(w) tc 33} )
:: ghc-prim:GHC.Prim.Addr#{(w) tc 33}
[LclId]
{GhcPanic.hs:10:9-46}
{GhcPanic.hs:10:9-22}
{GhcPanic.hs:10:9-12}
( ip1p{v acK} [lid] :: base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ) )@({GhcPanic.hs:10:15-21}
{GhcPanic.hs:10:15-17}
base:GHC.Ptr.Ptr{d r3C}{EvBinds{}} ((( ip1{v acP} [lid] :: ghc-prim:GHC.Prim.Addr#{(w) tc 33} )
:: ghc-prim:GHC.Prim.Addr#{(w) tc 33})))
= {GhcPanic.hs:10:26-46}
{GhcPanic.hs:10:34-42}
(base:GHC.Ptr.plusPtr{v r3E})
@ (ghc-prim:GHC.Prim.Any{(w) tc 31N}
ghc-prim:GHC.Prim.*{(w) tc 34d})
@ ( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )
((base:GHC.Ptr.Ptr{v r39})
@ (ghc-prim:GHC.Prim.Any{(w) tc 31N}
ghc-prim:GHC.Prim.*{(w) tc 34d})
ip0{v acF})
len{v acD}
EvBinds{}
( ip1p{v acI} [lid] :: forall ( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ).
base:GHC.Ptr.Ptr{tc 33A}
( t{tv acU} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} ) )
@ ( t{tv ad5} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d} )
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
It might be that its an instance of #4498 (closed).
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |