summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-09-10 09:58:20 +0200
committerSebastian Graf <sebastian.graf@kit.edu>2021-09-10 15:18:41 +0200
commit6fda42c45220710ea74bc0e3f2fa16cd7d043deb (patch)
tree3746096d44b2699acececcf2fce49bc981338141
parent86e5a6c34128a20d04808fcffcc49623a5d967bf (diff)
downloadhaskell-wip/sgraf-misc-3.tar.gz
Break recursion in GHC.Float.roundingMode# (#20352)wip/sgraf-misc-3
Judging from the Assumption, we should never call `roundingMode#` on a negative number. Yet the strange "dummy" conversion from `IN` to `IP` and the following recursive call where making the function recursive. Replacing the call by a panic makes `roundingMode#` non-recursive, so that we may be able to inline it. Fixes #20352. It seems we trigger #19414 on some jobs, hence Metric Decrease: T12545
-rw-r--r--libraries/base/GHC/Float.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/libraries/base/GHC/Float.hs b/libraries/base/GHC/Float.hs
index 743da55df8..2fb30c5712 100644
--- a/libraries/base/GHC/Float.hs
+++ b/libraries/base/GHC/Float.hs
@@ -1293,7 +1293,7 @@ roundingMode# (IS i#) t =
then 2#
else 1#
-roundingMode# (IN bn) t = roundingMode# (IP bn) t -- dummy
+roundingMode# (IN _) _ = errorWithoutStackTrace "roundingMode#: IN" -- See the Assumption
roundingMode# (IP bn) t =
let
j = word2Int# (int2Word# t `and#` MMASK##) -- index of relevant bit in word