WASM NCG panic: destination label not in evaluation context
Summary
When compiling stringsearch, compilation fails with
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.6.1:
destination label not in evaluation context
CallStack (from HasCallStack):
panic, called at compiler/GHC/Wasm/ControlFlow/FromCmm.hs:303:17 in ghc:GHC.Wasm.ControlFlow.FromCmm
Steps to reproduce
Download Repro.hs
(superficially minimised from stringsearch
) and compile it with optimizations, e.g.
wget https://gist.githubusercontent.com/amesgen/bb0a4278b2b1d4a8eaef5c484769caf6/raw/b9c167204ec5068a3bee30c7d93ae697e34a64bc/Repro.hs
wasm32-wasi-ghc -O1 Repro.hs
It compiles fine with -O0
.
Expected behavior
It should compile without panicking.
Environment
- GHC version used: 9.6.1; concretely: 9.6 and gmp flavour from ghc-wasm-meta, commit 3883ee24
- Operating System: NixOS
- System Architecture: x86_64-linux