Ticket #7323 (closed bug: invalid)
decoding GADTs gives internal error: stg_ap_v_ret
|Reported by:||heisenbug||Owned by:|
|Operating System:||Linux||Architecture:||x86_64 (amd64)|
|Type of failure:||Runtime crash||Difficulty:||Unknown|
|Test Case:||yes||Blocked By:|
May be related to #4987, 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.