Skip to content

decoding GADTs gives internal error: stg_ap_v_ret

May be related to #4987 (closed), but this time I have a reproducible case.

So far I found out that the %INFO_TYPE(%STD_INFO(info)) in stg_ap_v is 4 (==CONSTR_2_0) just before barfing.

The unsafe cast is just to generalize to the return type, but seem to be crucial. When I make TypedPair unparametrized or remove the TPInt constructor (but remaining a GADT), the crash goes away.

The problem does not happen with GHCi (with this testcase), but I have seen the same crash in GHCi too with a more involved code example.

I compiled vanilla: ghc internal-error.lhs; ./internal-error

I did not test with older compilers.

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