"Can't use Natural in base" when compiling GHC.Natural with -O0
_build/stage0/bin/ghc -Wall -hisuf hi -osuf o -hcsuf hc -static -hide-all-packages -no-user-package-db '-package-db _build/stage1/lib/package.conf.d' '-this-unit-id base-4.12.0.0' '-package-id ghc-prim-0.5.3' '-package-id integer-simple-0.1.1.1' '-package-id rts-1.0' -i -i_build/stage1/libraries/base/build -i_build/stage1/libraries/base/build/autogen -ilibraries/base/. -Iincludes -I_build/generated -I_build/stage1/libraries/base/build -I_build/stage1/libraries/base/build/include -Ilibraries/base/include -I/home/travis/build/snowleopard/hadrian/ghc/_build/stage1/lib/x86_64-linux-ghc-8.5.20180617/rts-1.0/include -I_build/generated -optc-I_build/generated -optP-include -optP_build/stage1/libraries/base/build/autogen/cabal_macros.h -optc-std=gnu99 -optc-fno-stack-protector -optP-std=gnu99 -odir _build/stage1/libraries/base/build -hidir _build/stage1/libraries/base/build -stubdir _build/stage1/libraries/base/build -Wnoncanonical-monad-instances -optc-Werror=unused-but-set-variable -optc-Wno-error=inline -c libraries/base/GHC/Num.hs -o _build/stage1/libraries/base/build/GHC/Num.o -O0 -H64m -this-unit-id base -Wcompat -Wnoncanonical-monad-instances -XHaskell2010 -ghcversion-file=/home/travis/build/snowleopard/hadrian/ghc/_build/generated/ghcversion.h -Wno-deprecated-flags -Wno-trustworthy-safe
Exit code: 1
Stderr:
ghc: panic! (the 'impossible' happened)
(GHC version 8.5.20180617 for x86_64-unknown-linux):
Can't use Natural in base
We noticed this in hadrian land (in this PR and https://github.com/snowleopard/hadrian/issues/629), and noticed that this happens:
- with 8.4.2 as the boot compiler but not 8.2.2
- with integer-simple as the integer library
- only with the quickest flavour (or more generally when we build GHC.Natural with -O0)
Some optimisation seems critical to making any trace of Natural
disappear, but this seems rather fragile. The code that throws the error got introduced in fe770c21.
The full build log is available here, anchored to where the error appears.
An example of hadrian command to reproduce the problem, assuming a configured build tree: hadrian/build.sh --flavour=quickest --integer-simple -j4
.
Trac metadata
Trac field | Value |
---|---|
Version | 8.5 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | bgamari |
Operating system | |
Architecture |