From 6fda42c45220710ea74bc0e3f2fa16cd7d043deb Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 10 Sep 2021 09:58:20 +0200 Subject: 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 --- libraries/base/GHC/Float.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.1