GHC 8.8.2 miscompiles program with -fcatch-bottoms

Csaba Hruska csaba.hruska at
Sun Feb 16 13:19:01 UTC 2020


I've tried to compile GHC from source using -fcatch-bottoms on the stage2.
I compiled GHC with having *GhcStage2HcOpts += -fcatch-bottoms* in
Unfortunately it breaks programs and causes runtime error. I wanted to use
this feature in an experiment.
My motivation:

*I'm working on a typed external STG IR were the type system is based
according GHC's PrimRep ADT. In my Ext-STG IR each case alt must have the
same PrimRep result type. The vanilla Core to Stg pass breaks this
invariant but the catch-bottoms option preserves it. *


Error output:

===--- building phase 0
make --no-print-directory -f phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f phase=1 phase_1_builds
make[1]: Nothing to be done for 'phase_1_builds'.
===--- building final phase
make --no-print-directory -f phase=final all
"inplace/bin/ghc-stage2" -hisuf dyn_hi -osuf  dyn_o -hcsuf dyn_hc -fPIC
-dynamic  -H32m -O -Wall      -hide-all-packages -i -iutils/haddock/driver
-iutils/haddock/haddock-api/src -iutils/haddock/haddock-library/src
-iutils/haddock/dist/build -Iutils/haddock/dist/build
-Iutils/haddock/dist/build/haddock/autogen    -optP-DIN_GHC_TREE
-optP-include -optPutils/haddock/dist/build/haddock/autogen/cabal_macros.h
-package-id array- -package-id base- -package-id
bytestring- -package-id containers- -package-id
deepseq- -package-id directory- -package-id filepath-
-package-id ghc-8.8.2 -package-id ghc-boot-8.8.2 -package-id
parsec- -package-id text- -package-id transformers-
-package-id xhtml-3000.2.2.1 -funbox-strict-fields -Wall -fwarn-tabs -O2
-threaded -XHaskell2010  -no-user-package-db -rtsopts  -Wno-unused-imports
-Wno-deprecations     -Wnoncanonical-monad-instances  -outputdir
utils/haddock/dist/build    -c
utils/haddock/haddock-library/src/Documentation/Haddock/Types.hs -o

*ghc-stage2: internal error: evacuate(static): strange closure type 0
(GHC version 8.8.2 for x86_64_unknown_linux)    Please report this as a GHC
utils/haddock/ recipe for target
'utils/haddock/dist/build/Documentation/Haddock/Types.dyn_o' failed
make[1]: *** [utils/haddock/dist/build/Documentation/Haddock/Types.dyn_o]
Aborted (core dumped)
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list