obscure impossible problem with simplifier

Samuel Bronson naesten at gmail.com
Sat Nov 4 18:55:03 EST 2006


I think the simplifier is doing something iffy with types, because
when I try to call exprType from SimplUtils.interestingArg, I get
this:

ghc-6.5: panic! (the 'impossible' happened)
  (GHC version 6.5 for i386-unknown-linux):
        applyTypeToArgs
    a98{v a1eB} [lid] ex{v aqZ} [lid]
    a{tv a1et} [tv]

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

make: *** [GHC/TopHandler.o] Error 1

I think you only need to add this code:

interestingArg expr | pprTrace "interestingArg" (ppr expr) $
                      isUnLiftedType (exprType expr) =
        -- Unlifted args are only ever interesting if we know what
they are
                        case expr of
                        Lit lit -> True
                        _       -> False

at the top of the "interestingArg" function to get this error.
The call chain looks like:
completeCall -> interestingArg -> exprType -> applyTypeToArgs

I think somehow an ill-typed variable has been stuffed into the
SimplCont? Or perhaps contArgs isn't substituting right? Anyway I
can't find anything in the immediate area to indicate what the problem
might be caused by... and I really hope it *is* a bug.

Btw, here is some relevant trace info:

completeCall
    var: base:GHC.IOBase.>>{v rgF} [gid]
    cont: ApplyTo nodup TYPE base:GHC.Base.(){(w) tc 40}
          ApplyTo nodup TYPE a{tv a13f} [sk]
          ApplyTo nodup handler{v ar2} [lid] ex{v aqZ} [lid]
          ApplyTo nodup lvl_s1dT{v} [lid] @ a{tv a13f} [sk]
          CoerceIt (base:GHC.IOBase.:CoIO{tc r3v}) a{tv a13f} [sk]
          ApplyTo nodup new_s{v a1eg} [lid]
          Stop[arg] (# base:GHC.Prim.State#{(w) tc 32q}
base:GHC.Prim.RealWorld{(w) tc 31E},
                       a{tv a13f} [sk] #)
contArgs
    -> ([TYPE base:GHC.Base.(){(w) tc 40}, TYPE a{tv a13f} [sk],
         a98{v a1eh} [lid] ex{v aqZ} [lid],
         lvl_s1dT{v} [lid] @ a{tv a13f} [sk]],
        CoerceIt (base:GHC.IOBase.:CoIO{tc r3v}) a{tv a13f} [sk]
        ApplyTo nodup new_s{v a1eg} [lid]
        Stop[arg] (# base:GHC.Prim.State#{(w) tc 32q}
base:GHC.Prim.RealWorld{(w) tc 31E},
                     a{tv a13f} [sk] #))

If you can guess what that might mean, great. If not, well, you could
do your own tracing. Now if you'll excuse me I have a headache :-(.
Potentially related to trying to follow the simplifier.

This definately didn't happen before the recent simplifier changes.


More information about the Cvs-ghc mailing list