diff options
Diffstat (limited to 'testsuite/tests/lib/integer/T18813.hs')
-rw-r--r-- | testsuite/tests/lib/integer/T18813.hs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/lib/integer/T18813.hs b/testsuite/tests/lib/integer/T18813.hs new file mode 100644 index 0000000000..77f598fe7b --- /dev/null +++ b/testsuite/tests/lib/integer/T18813.hs @@ -0,0 +1,22 @@ +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE MagicHash #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# OPTIONS_GHC -O0 #-} + +import GHC.Exts +import GHC.Num.BigNat (bigNatCompareWord#, bigNatFromWord#) +import GHC.Num.Integer (integerGcd) + +main :: IO () +main = do + let + x = noinline (14205695611797621937 :: Integer) + y = noinline (2 :: Word) + print (integerGcd x (toInteger y)) + print (toInteger (gcd (fromInteger x) y :: Word)) + + let + x@(W# x#) = 1 :: Word + !x' = bigNatFromWord# x# + print (bigNatCompareWord# x' x#) + print (compare x x) |