GHC 9.2.4 regression: unable to compile test application that worked in 9.2.3
Summary
Unable to compile the test-rdfproof executable from swish with GHC 9.2.4 as it appears to just hang. I have built this with many previous versions, including GHC 9.2.3.
I originally reported it to GHC devs
Steps to reproduce
Unfortunately this is an involved process as I have no idea
- what the problem is
- how to just compile the test executable
Initial diagnosis by Oleg
Before providing the basic reproduction steps (copied from the email above), @phadej provided some useful compilation info which I report below
I quickly tried with with {-# OPTIONS_GHC -ddump-timings
-ddump-simpl-trace -ddump-to-file #-} in RDFProofTest.hs and at some
point simplifier does nothing. The simpl-trace file doesn't grow. The
GHC just seems to spin.
After that
- I checked out the `ghc-9.2.4-release` tag,
- built it --flavour=default+profiled_ghc+no_dynamic_ghc
- built the swish using cabal pointing to GHC used (on my machine: cabal
build -w /code/ghc/_build_ghc-9.2/stage1/bin/ghc test-rdfproof -v3)
- copy pasted the command cabal used to execute ghc, which is long, and
added +RTS -xc -RTS there
After that, if I ^C when GHC seems to be spinning, the stack trace is
consistently the same:
^C*** Exception (reporting due to +RTS -xc): (THUNK_STATIC), stack trace:
GHC.Core.Opt.Pipeline.CallArity,
called from GHC.Driver.Main.Core2Core,
called from GHC.Driver.Main.hscSimplify',
called from GHC.Driver.Main.finish,
called from GHC.Driver.Main.hscIncrementalCompile,
called from GHC.Driver.Make.upsweep_mod.compile_it,
called from GHC.Driver.Make.upsweep_mod,
called from GHC.Driver.Make.upsweep.upsweep',
called from GHC.Driver.Make.upsweep,
called from GHC.Driver.Make.withDeferredDiagnostics,
called from GHC.Driver.Make.load'.checkHowMuch,
called from GHC.Driver.Make.load',
called from GHC.Driver.Make.load,
called from GHC.withCleanupSession,
called from GHC.runGhc,
called from GHC.defaultErrorHandler
Hopefully this illustrates how to reproduce with your own GHC.
I also tried with GHC-9.4.1 (using --allow-newer=base) and GHC panics:
[ 6 of 55] Compiling Swish.GraphMatch
<no location info>: error:
panic! (the 'impossible' happened)
GHC version 9.4.1:
funResultTy
GenLabelMap lb_adrG LabelIndex
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/Type.hs:1334:49 in
ghc:GHC.Core.Type
GHC-9.4.2 panics in the same way.
Maybe these failures are related?
- Oleg
Download the code
I am on a linux machine (ubuntu 22.04) and have seen this with builds either with stack or nix.
% git clone https://gitlab.com/dburke/swish temp
% cd temp
% git rev-parse HEAD
09c92e0fbbea9be86cac5c8e273e1d5915a9eeae
Added to get the timings, but it's not strictly necessary:
% sed -i -e "s/-Wall /-Wall -ddump-timings /" swish.cabal
building with stack
If you try with --resolver lts-19.22
(ghc 9.0.2) then it works. With GHC 9.2.4 it fails:
% stack test --resolver nightly-2022-09-05 :test-rdfproof
...
*** Parser [Main]:
Parser [Main]: alloc=24346008 time=8.730
*** Renamer/typechecker [Main]:
Renamer/typechecker [Main]: alloc=58415776 time=44.077
*** Desugar [Main]:
Desugar [Main]: alloc=22148416 time=15.693
*** Simplifier [Main]:
Simplifier [Main]: alloc=651048904 time=530.123
*** Specialise [Main]:
Specialise [Main]: alloc=44412080 time=31.885
*** Float out(FOS {Lam = Just 0,
Consts = True,
OverSatApps = False}) [Main]:
Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False})
[Main]: alloc=207753368 time=259.238
*** Simplifier [Main]:
Simplifier [Main]: alloc=599788216 time=548.107
*** Simplifier [Main]:
Simplifier [Main]: alloc=562910904 time=474.847
*** Simplifier [Main]:
Simplifier [Main]: alloc=725093584 time=643.255
Float inwards [Main]: alloc=23720 time=0.011
Called arity analysis [Main]: alloc=25856 time=0.012
*** Float inwards [Main]:
*** Called arity analysis [Main]:
*** Simplifier [Main]:
At this point it just makes my laptop fan spin faster wit h one of my CPUs pegged at 100%, but it never seems to print anything more.
building with nix
This works
% nix-shell --argstr compiler ghc923
% cabal test test-rdfproof
With 9.2.4 you get similar to above (the screen messages don't quite agree):
% nix-shell --argstr compiler ghc924
cabal test test-rdfproof
Warning: The package list for 'hackage.haskell.org' is 20 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Build profile: -w ghc-9.2.4 -O1
In order, the following will be built (use -v for more details):
- swish-0.10.2.0 (test:test-rdfproof) (first run)
Preprocessing test suite 'test-rdfproof' for swish-0.10.2.0..
Building test suite 'test-rdfproof' for swish-0.10.2.0..
*** initializing unit database:
initializing unit database: alloc=7389248 time=4.462
*** initializing unit database:
initializing unit database: alloc=4001312 time=11.664
*** Chasing dependencies:
*** systool:cpp:
systool:cpp: alloc=319464 time=0.481
Chasing dependencies: alloc=12861208 time=6.331
[2 of 2] Compiling Main ( tests/RDFProofTest.hs,
/home/dburke/rdf/temp/dist-newstyle/build/x86_64-linux/ghc-9.2.4/swish-0.10.2.0/t/test-rdfproof/build/test-rdfproof/test-rdfproof-tmp/Main.o
)
*** Parser [Main]:
Parser [Main]: alloc=25236056 time=23.982
*** Renamer/typechecker [Main]:
Renamer/typechecker [Main]: alloc=101830968 time=97.529
*** Desugar [Main]:
Desugar [Main]: alloc=24617072 time=19.187
*** Simplifier [Main]:
Simplifier [Main]: alloc=665051592 time=558.078
*** Specialise [Main]:
Specialise [Main]: alloc=44894576 time=30.341
*** Float out(FOS {Lam = Just 0,
Consts = True,
OverSatApps = False}) [Main]:
Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False})
[Main]: alloc=208060752 time=245.458
*** Simplifier [Main]:
Simplifier [Main]: alloc=602721856 time=555.073
*** Simplifier [Main]:
Simplifier [Main]: alloc=563887832 time=529.865
*** Simplifier [Main]:
Simplifier [Main]: alloc=727381840 time=606.367
*** Float inwards [Main]:
Float inwards [Main]: alloc=23720 time=0.012
*** Called arity analysis [Main]:
Called arity analysis [Main]: alloc=25848 time=0.012
*** Simplifier [Main]:
and here it hangs.
Expected behavior
To compile the program.
Environment
- GHC version used: 9.2.4
Optional:
- Operating System: linux
- System Architecture: x86_64-linux