summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2022-06-14 20:53:42 -0400
committerZubin Duggal <zubin.duggal@gmail.com>2022-07-14 14:39:37 +0530
commitbb7b2e6f876806e65ec07d1d8638dde54c34ded4 (patch)
tree384b71dc4a7056c97e7f1094da40024d269a876a
parent2c1a5ae85966e1e87c33c7c62ab876c9287ca4d6 (diff)
downloadhaskell-bb7b2e6f876806e65ec07d1d8638dde54c34ded4.tar.gz
testsuite: Add test for #21624
Ensuring that mulIntMayOflo# behaves as expected. (cherry picked from commit 26745006bdecc2d269fd8252b189650d6bd7ac10)
-rw-r--r--testsuite/tests/primops/should_run/T21624.hs11
-rw-r--r--testsuite/tests/primops/should_run/T21624.stdout1
-rw-r--r--testsuite/tests/primops/should_run/all.T2
3 files changed, 14 insertions, 0 deletions
diff --git a/testsuite/tests/primops/should_run/T21624.hs b/testsuite/tests/primops/should_run/T21624.hs
new file mode 100644
index 0000000000..4b08fbd732
--- /dev/null
+++ b/testsuite/tests/primops/should_run/T21624.hs
@@ -0,0 +1,11 @@
+{-# LANGUAGE MagicHash #-}
+
+import GHC.Int
+import GHC.Prim
+
+mulIntMayOflo :: Int -> Int -> Bool
+mulIntMayOflo (I# x) (I# y) = I# (mulIntMayOflo# x y) /= 0
+
+main :: IO ()
+main = print (mulIntMayOflo maxBound 0x4)
+
diff --git a/testsuite/tests/primops/should_run/T21624.stdout b/testsuite/tests/primops/should_run/T21624.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/primops/should_run/T21624.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/primops/should_run/all.T b/testsuite/tests/primops/should_run/all.T
index dbb82fd11e..5d7f19d6d8 100644
--- a/testsuite/tests/primops/should_run/all.T
+++ b/testsuite/tests/primops/should_run/all.T
@@ -36,3 +36,5 @@ test('ShrinkSmallMutableArrayA', normal, compile_and_run, [''])
test('ShrinkSmallMutableArrayB', normal, compile_and_run, [''])
test('T14664', normal, compile_and_run, [''])
test('CStringLength', normal, compile_and_run, ['-O2'])
+
+test('T21624', normal, compile_and_run, [''])