findRhsArity never(?) reaches a fix point (9.2 pre-release)
Summary
GHC 9.2 loops forever(?) in findRhsArity
(https://gitlab.haskell.org/ghc/ghc/-/blob/5b9846a51b599a076e651e19f8226b9043a202f0/compiler/GHC/Core/Opt/Arity.hs#L635)
Steps to reproduce
The reproducer is part of a proprietary codebase and I was hoping with some guidance I might be able to narrow it down to a shareable example. I managed to work around the issue with a well-placed NOINLINE pragma in one module.
If I turn on the debug print in findRhsArity
I see the below output (and the number of ? just keeps growing). (OptProperties
is from optparse-applicative (https://hackage.haskell.org/package/optparse-applicative-0.16.1.0/docs/Options-Applicative-Types.html#t:OptProperties))
WARNING: file compiler/GHC/Core/Opt/Arity.hs, line 659
Exciting arity
g2_X7c \???.⊥ \????.⊥
\ (x_X7c :: OptProperties) -> x_X7c
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Driver/Ppr.hs:140:29 in ghc:GHC.Driver.Ppr
warnPprTrace, called at compiler/GHC/Core/Opt/Arity.hs:656:11 in ghc:GHC.Core.Opt.Arity
WARNING: file compiler/GHC/Core/Opt/Arity.hs, line 659
Exciting arity
g2_X7c \????.⊥ \?????.⊥
\ (x_X7c :: OptProperties) -> x_X7c
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Driver/Ppr.hs:140:29 in ghc:GHC.Driver.Ppr
warnPprTrace, called at compiler/GHC/Core/Opt/Arity.hs:656:11 in ghc:GHC.Core.Opt.Arity
WARNING: file compiler/GHC/Core/Opt/Arity.hs, line 659
Exciting arity
g2_X7c \?????.⊥ \??????.⊥
\ (x_X7c :: OptProperties) -> x_X7c
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Driver/Ppr.hs:140:29 in ghc:GHC.Driver.Ppr
warnPprTrace, called at compiler/GHC/Core/Opt/Arity.hs:656:11 in ghc:GHC.Core.Opt.Arity
WARNING: file compiler/GHC/Core/Opt/Arity.hs, line 659
Exciting arity
g2_X7c \??????.⊥ \???????.⊥
\ (x_X7c :: OptProperties) -> x_X7c
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Driver/Ppr.hs:140:29 in ghc:GHC.Driver.Ppr
warnPprTrace, called at compiler/GHC/Core/Opt/Arity.hs:656:11 in ghc:GHC.Core.Opt.Arity
...
Expected behavior
Terminating compilation.
Environment
- GHC version used: 9.2 pre-release at 5b9846a5
Optional:
- Operating System: rhel
- System Architecture: x86_64