Skip to content

GHCi thinks large list literals impossible?

Prelude> :set -fth
Prelude> $(let s = replicate 26227 'x' in [| s |])
Loading package template-haskell ... linking ... done.
ghc-6.6: panic! (the 'impossible' happened)
  (GHC version 6.6 for i386-unknown-linux):
        mkProtoBCO: stack use won't fit in 16 bits 131145

Note: I ran into this with a far more interestinng string, which I actually used TH to generate, but the code was a lot longer. I think this happens partly because Strings are lifted as ListE}}s of {{{(LitE . CharL)s, rather than as {LitE . StrinL}s, but even if you changed that I could still get the same thing to happen by replacing 'x' with (1::Int), so obviously that isn't the whole problem. (Why in the world does the code for long list literals need an enormous stack anyway?)

On a side note, this also crashes -ddump-ds, though that's probably reasonable...

Trac metadata
Trac field Value
Version 6.6
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Unknown
Architecture Unknown
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information