Add regression test for old Word32 arithmetic issue (#497)
authorKevin Buhr <buhr@asaurus.net>
Fri, 10 May 2019 00:56:53 +0000 (19:56 -0500)
committerMarge Bot <ben+marge-bot@smart-cactus.org>
Wed, 22 May 2019 20:45:08 +0000 (16:45 -0400)
testsuite/tests/numeric/should_run/T497.hs [new file with mode: 0644]
testsuite/tests/numeric/should_run/T497.stdout [new file with mode: 0644]
testsuite/tests/numeric/should_run/all.T

diff --git a/testsuite/tests/numeric/should_run/T497.hs b/testsuite/tests/numeric/should_run/T497.hs
new file mode 100644 (file)
index 0000000..9605b4e
--- /dev/null
@@ -0,0 +1,12 @@
+import Data.Word
+
+-- #497: using -O should not make these == 1
+main = do
+  print $ q * 2 + 1
+  print $ q' * 2 + 1
+
+q :: Word32
+q = 0x7FFFFFFF
+
+q' :: Word64
+q' = 0x7FFFFFFFFFFFFFFF
diff --git a/testsuite/tests/numeric/should_run/T497.stdout b/testsuite/tests/numeric/should_run/T497.stdout
new file mode 100644 (file)
index 0000000..664b67d
--- /dev/null
@@ -0,0 +1,2 @@
+4294967295
+18446744073709551615
index a966038..cf2e2ea 100644 (file)
@@ -67,3 +67,4 @@ test('T10962', omit_ways(['ghci']), compile_and_run, ['-O2'])
 test('T11702', extra_ways(['optasm']), compile_and_run, [''])
 test('T12136', normal, compile_and_run, [''])
 test('T15301', normal, compile_and_run, ['-O2'])
+test('T497', normal, compile_and_run, ['-O'])