summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-09-10 09:58:20 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-09-11 08:58:04 -0400
commit2d15175266d0e0d9ca6565124b0c17e207b5541c (patch)
treef3143ca1463d7b169851f510dd05ccdb60e69ad5
parent070ae69c0c8cee2b778907805134d327964a0c0f (diff)
downloadhaskell-2d15175266d0e0d9ca6565124b0c17e207b5541c.tar.gz
Break recursion in GHC.Float.roundingMode# (#20352)
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