GHC simplifier loops
In a situation that feels similar to #22112 (closed), the output of the Prep stage loops when processing a recursive definition. The big difference is that I haven't been able to reproduce this using GHC-as-a-program, because it requires saving to and then loading back from an interface file-ish representation.
The attached program compiles with GHC as of 161a6f1f and when run, typechecks and compiles up to Tidy a small program that contains a recursive definition. The Tidy binding is saved into a file alongside the ModIface
. Afterwards, in a fresh GHC session, the ModIface
and the binding is loaded, and then the binding is processed by Prep. When we try to print the length of the binds returned by Prep, we loop.
Similar to #22112 (closed), this only happens when unfoldings are preserved, and when the definition in the input file is recursive. Opt_NoTypeBinds
is only turned on to make it easier to process the resulting binds; unlike all other settings in setup
, that one is not essential to reproduce the problem.