From bff74de713dac3e62c3bb6f1946e0649549f2215 Mon Sep 17 00:00:00 2001 From: Sylvain Henry Date: Mon, 2 Nov 2020 15:24:38 +0100 Subject: Bignum: make GMP's bignat_add not recursive bignat_add was a loopbreaker with an INLINE pragma (spotted by @mpickering). This patch makes it non recursive to avoid the issue. --- libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs b/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs index 8db1dd57b2..649a7acc70 100644 --- a/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs +++ b/libraries/ghc-bignum/src/GHC/Num/Backend/GMP.hs @@ -70,13 +70,13 @@ bignat_add -> State# RealWorld {-# INLINE bignat_add #-} bignat_add mwa wa wb s - -- weird GMP requirement + -- weird GMP requirement: the biggest comes first | isTrue# (wordArraySize# wb ># wordArraySize# wa) - = bignat_add mwa wb wa s + = case ioWord# (c_mpn_add mwa wb (wordArraySize# wb) wa (wordArraySize# wa)) s of + (# s', c #) -> mwaWriteMostSignificant mwa c s' | True - = do - case ioWord# (c_mpn_add mwa wa (wordArraySize# wa) wb (wordArraySize# wb)) s of + = case ioWord# (c_mpn_add mwa wa (wordArraySize# wa) wb (wordArraySize# wb)) s of (# s', c #) -> mwaWriteMostSignificant mwa c s' bignat_add_word -- cgit v1.2.1