GHC panic with -O -fno-cpr-anal -fno-cse -fno-full-laziness
Summary
Panic in GHC 9.4.3 when compiling 4-line program with -O -fno-cpr-anal -fno-cse -fno-full-laziness
. No panic occurs on 9.2.5.
Steps to reproduce
Put the following code in a file named Bug.hs
module Bug where
import Data.Set
foo x = sequence_ [ f y | y <- x ]
where f _ = return (fromList [0])
Now, on the command line:
$ ghc -O -fno-cpr-anal -fno-cse -fno-full-laziness Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.4.3:
completeCall
conrep_X1
Stop[BoringCtxt] Integer
Call stack:
CallStack (from HasCallStack):
callStackDoc, called at compiler/GHC/Utils/Panic.hs:182:37 in ghc:GHC.Utils.Panic
pprPanic, called at compiler/GHC/Core/Opt/Simplify.hs:1911:9 in ghc:GHC.Core.Opt.Simplify
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
Removing any of the command-line flags seems to cause the panic to disappear.
Expected behavior
Compile without a panic.
(Why the strange combination of flags? One of our larger source files takes a long time to compile unless cpr-anal is turned off. The other options are there for historic reasons and not really needed, but still I thought I'd report the bug in case in shows up in other ways.)
Environment
- GHC version used: 9.4.3
Optional:
- Operating System: Linux
- System Architecture: x86_64