#2898: crash when interpreting
-------------------------+--------------------------------------------------
Reporter: nolrai | Owner: simonpj
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Linux
Architecture: x86 |
-------------------------+--------------------------------------------------
Changes (by simonpj):
* owner: => simonpj
* difficulty: => Unknown
Old description:
> when I interpret my file Utilities/ChoiceMonad.hs from ghci-haskline I
> get the following message:
>
> [2 of 2][Compiling Utilities.ChoiceMonad ( Utilities/ChoiceMonad.hs,
> interpreted )
> ghci-haskeline: panic! (the 'impossible' happened)
> (GHC version 6.10.1 for i386-unknown-linux):
> ByteCodeGen.schemeE: unhandled case
> \ (@ a1{tv a1qQ} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d})
> (@ b1{tv a1qR} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d}) ->
> case {tick (main:Utilities.ChoiceMonad, 169)}{v d1z7} [gid]
> @ (ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc 31E})
> {(a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
> -> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
> m{tv aQH} [sk] a1{tv a1qQ} [sk]
> -> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
> m{tv aQH} [sk] b1{tv a1qR} [sk]}
> of (tick{v s29j} [lid] :: ghc-prim:GHC.Prim.State#{(w) tc 32q}
> ghc-prim:GHC.Prim.RealWorld{(w) tc
> 31E})
> { __DEFAULT ->
> let {
> sat_s20H{v} [lid] :: (a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
> -> main:Utilities.LeafyTree.LeafyTree{tc
> rfw} a1{tv a1qQ} [sk]
> -> main:Utilities.LeafyTree.LeafyTree{tc
> rfw} b1{tv a1qR} [sk]
> []
> sat_s20H{v} [lid] =
> base:GHC.Base.fmap{v r5G} [gid]
> @ main:Utilities.LeafyTree.LeafyTree{tc rfw}
> main:Utilities.LeafyTree.$f4{v rfq} [gid]
> @ a1{tv a1qQ} [sk]
> @ b1{tv a1qR} [sk] } in
> let {
> sat_s20F{v} [lid] :: (main:Utilities.LeafyTree.LeafyTree{tc rfw}
> a1{tv a1qQ} [sk]
> -> main:Utilities.LeafyTree.LeafyTree{tc
> rfw} b1{tv a1qR} [sk])
> -> main:Utilities.ChoiceMonad.ChoiceT{tc
> rJw}
> m{tv aQH} [sk] a1{tv a1qQ} [sk]
> -> main:Utilities.ChoiceMonad.ChoiceT{tc
> rJw}
> m{tv aQH} [sk] b1{tv a1qR} [sk]
> []
> sat_s20F{v} [lid] =
> main:Utilities.ChoiceMonad.inChoiceT{v rLn} [gid]
> @ m{tv aQH} [sk]
> @ a1{tv a1qQ} [sk]
> @ b1{tv a1qR} [sk]
> $dMonad1{v s20D} [lid] } in
> base:GHC.Base..{v r4k} [gid]
> @ (main:Utilities.LeafyTree.LeafyTree{tc rfw} a1{tv a1qQ} [sk]
> -> main:Utilities.LeafyTree.LeafyTree{tc rfw} b1{tv a1qR}
> [sk])
> @ (main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
> m{tv aQH} [sk] a1{tv a1qQ} [sk]
> -> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
> m{tv aQH} [sk] b1{tv a1qR} [sk])
> @ (a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
> sat_s20F{v} [lid]
> sat_s20H{v} [lid]
> }
>
> Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
>
> but if i do "ghc --make Utilities/ChoiceMonad.hs" that works and I can
> then load it with ghci-haskline, at least until I modify it and need to
> compile again.
New description:
when I interpret my file Utilities/ChoiceMonad.hs from ghci-haskline I get
the following message:
{{{
[2 of 2][Compiling Utilities.ChoiceMonad ( Utilities/ChoiceMonad.hs,
interpreted )
ghci-haskeline: panic! (the 'impossible' happened)
(GHC version 6.10.1 for i386-unknown-linux):
ByteCodeGen.schemeE: unhandled case
\ (@ a1{tv a1qQ} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d})
(@ b1{tv a1qR} [sk] :: ghc-prim:GHC.Prim.*{(w) tc 34d}) ->
case {tick (main:Utilities.ChoiceMonad, 169)}{v d1z7} [gid]
@ (ghc-prim:GHC.Prim.State#{(w) tc 32q}
ghc-prim:GHC.Prim.RealWorld{(w) tc 31E})
{(a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
-> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] a1{tv a1qQ} [sk]
-> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] b1{tv a1qR} [sk]}
of (tick{v s29j} [lid] :: ghc-prim:GHC.Prim.State#{(w) tc 32q}
ghc-prim:GHC.Prim.RealWorld{(w) tc 31E})
{ __DEFAULT ->
let {
sat_s20H{v} [lid] :: (a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
-> main:Utilities.LeafyTree.LeafyTree{tc rfw}
a1{tv a1qQ} [sk]
-> main:Utilities.LeafyTree.LeafyTree{tc rfw}
b1{tv a1qR} [sk]
[]
sat_s20H{v} [lid] =
base:GHC.Base.fmap{v r5G} [gid]
@ main:Utilities.LeafyTree.LeafyTree{tc rfw}
main:Utilities.LeafyTree.$f4{v rfq} [gid]
@ a1{tv a1qQ} [sk]
@ b1{tv a1qR} [sk] } in
let {
sat_s20F{v} [lid] :: (main:Utilities.LeafyTree.LeafyTree{tc rfw}
a1{tv a1qQ} [sk]
-> main:Utilities.LeafyTree.LeafyTree{tc
rfw} b1{tv a1qR} [sk])
-> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] a1{tv a1qQ} [sk]
-> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] b1{tv a1qR} [sk]
[]
sat_s20F{v} [lid] =
main:Utilities.ChoiceMonad.inChoiceT{v rLn} [gid]
@ m{tv aQH} [sk]
@ a1{tv a1qQ} [sk]
@ b1{tv a1qR} [sk]
$dMonad1{v s20D} [lid] } in
base:GHC.Base..{v r4k} [gid]
@ (main:Utilities.LeafyTree.LeafyTree{tc rfw} a1{tv a1qQ} [sk]
-> main:Utilities.LeafyTree.LeafyTree{tc rfw} b1{tv a1qR} [sk])
@ (main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] a1{tv a1qQ} [sk]
-> main:Utilities.ChoiceMonad.ChoiceT{tc rJw}
m{tv aQH} [sk] b1{tv a1qR} [sk])
@ (a1{tv a1qQ} [sk] -> b1{tv a1qR} [sk])
sat_s20F{v} [lid]
sat_s20H{v} [lid]
}
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
}}}
but if i do "ghc --make Utilities/ChoiceMonad.hs" that works and I can
then load it with ghci-haskline, at least until I modify it and need to
compile again.
Comment:
Excellent report thank you. What's happening is that `CorePrep` find an
application of a strict function
{{{
f (/\a. blah) ...
}}}
and transforms it to this:
{{{
case (/\a. blah) of { DEFAULT -> ... }
}}}
If there had been a value lambda, then `mkLocalNonRec` would have
generated a let, not a case. The unexpected type lambda confuses the code
generator.
In fact, since all code generators simply ignore type lambdas, there is no
reason to disallow them, unlike value lambdas which are supposed to occur
only on the RHS of let/recs. So I tidied up `ByteCodeGen` by
systematically using a fucntion `bcView` (bytecode view) that discards
casts, notes, type abstractions, and type applications. Result is
shorter, more robust code.
Patch to come.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2898#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs