Skip to content

unsafeCoerce of data constructor application results in invalid code generation

@RyanGlScott noticed that a program using his parameterized-utils library crashes reliably in all GHC versions from 8.6 to 9.0.1 and helpfully produced a minimal reproducer ($2777). Specifically compiling and running this program under -O0 results in a runtime error:

hi: internal error: stg_ap_pp_ret
    (GHC version 9.0.1 for x86_64_unknown_linux)
    Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug
Aborted (core dumped)

Running with -O2 prints an different result depending upon which GHC version is used.

Edited by Ben Gamari
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information