Hello,
I've tried to compile GHC from source using -fcatch-bottoms on the stage2.
I compiled GHC with having
GhcStage2HcOpts += -fcatch-bottoms in
build.mk.
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.
Cheers,
Csaba
Error output:
make
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
make[1]: Nothing to be done for 'phase_0_builds'.
===--- building phase 1
make --no-print-directory -f ghc.mk phase=1 phase_1_builds
make[1]: Nothing to be done for 'phase_1_builds'.
===--- building final phase
make --no-print-directory -f ghc.mk 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 -Iutils/haddock/dist/build/haddock/autogen -optP-DIN_GHC_TREE -optP-include -optPutils/haddock/dist/build/haddock/autogen/cabal_macros.h -package-id array-0.5.4.0 -package-id base-4.13.0.0 -package-id bytestring-0.10.10.0 -package-id containers-0.6.2.1 -package-id deepseq-1.4.4.0 -package-id directory-1.3.4.0 -package-id filepath-1.4.2.1 -package-id ghc-8.8.2 -package-id ghc-boot-8.8.2 -package-id parsec-3.1.14.0 -package-id text-1.2.4.0 -package-id transformers-0.5.6.2 -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 utils/haddock/dist/build/Documentation/Haddock/Types.dyn_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 bug: https://www.haskell.org/ghc/reportabug
utils/haddock/ghc.mk:20: 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