Fix ghc-bignum exceptions
We must ensure that exceptions are not simplified. Previously we used: case raiseDivZero of _ -> 0## -- dummyValue But it was wrong because the evaluation of `raiseDivZero` was removed and the dummy value was directly returned. See new Note [ghc-bignum exceptions]. I've also removed the exception triggering primops which were fragile. We don't need them to be primops, we can have them exported by ghc-prim. I've also added a test for #18359 which triggered this patch.
Showing
- compiler/GHC/Builtin/Names.hs 9 additions, 2 deletionscompiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/primops.txt.pp 2 additions, 43 deletionscompiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/Core/Make.hs 36 additions, 3 deletionscompiler/GHC/Core/Make.hs
- compiler/GHC/StgToCmm/Prim.hs 0 additions, 3 deletionscompiler/GHC/StgToCmm/Prim.hs
- libraries/ghc-bignum/src/GHC/Num/BigNat.hs 25 additions, 13 deletionslibraries/ghc-bignum/src/GHC/Num/BigNat.hs
- libraries/ghc-bignum/src/GHC/Num/BigNat/Check.hs 25 additions, 18 deletionslibraries/ghc-bignum/src/GHC/Num/BigNat/Check.hs
- libraries/ghc-bignum/src/GHC/Num/Integer.hs 4 additions, 2 deletionslibraries/ghc-bignum/src/GHC/Num/Integer.hs
- libraries/ghc-bignum/src/GHC/Num/Natural.hs 7 additions, 7 deletionslibraries/ghc-bignum/src/GHC/Num/Natural.hs
- libraries/ghc-bignum/src/GHC/Num/Primitives.hs 50 additions, 13 deletionslibraries/ghc-bignum/src/GHC/Num/Primitives.hs
- libraries/ghc-prim/GHC/Prim/Exception.hs 52 additions, 0 deletionslibraries/ghc-prim/GHC/Prim/Exception.hs
- libraries/ghc-prim/ghc-prim.cabal 1 addition, 0 deletionslibraries/ghc-prim/ghc-prim.cabal
- rts/Exception.cmm 19 additions, 0 deletionsrts/Exception.cmm
- rts/PrimOps.cmm 0 additions, 19 deletionsrts/PrimOps.cmm
- testsuite/tests/numeric/should_run/T18359.hs 18 additions, 0 deletionstestsuite/tests/numeric/should_run/T18359.hs
- testsuite/tests/numeric/should_run/T18359.stdout 2 additions, 0 deletionstestsuite/tests/numeric/should_run/T18359.stdout
- testsuite/tests/numeric/should_run/all.T 1 addition, 0 deletionstestsuite/tests/numeric/should_run/all.T
- testsuite/tests/primops/should_run/T14664.hs 4 additions, 3 deletionstestsuite/tests/primops/should_run/T14664.hs
Loading
Please register or sign in to comment