Test case for #10246
authorJoachim Breitner <mail@joachim-breitner.de>
Mon, 6 Apr 2015 07:37:42 +0000 (09:37 +0200)
committerJoachim Breitner <mail@joachim-breitner.de>
Mon, 6 Apr 2015 07:37:42 +0000 (09:37 +0200)
still marked known_broken. This also adds the test case for #10245,
which should pass once #10246 is fixed.

testsuite/tests/codeGen/should_run/T10245.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T10245.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T10246.hs [new file with mode: 0644]
testsuite/tests/codeGen/should_run/T10246.stdout [new file with mode: 0644]
testsuite/tests/codeGen/should_run/all.T

diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs
new file mode 100644 (file)
index 0000000..7094a1d
--- /dev/null
@@ -0,0 +1,13 @@
+f :: Int -> String
+f n = case n of
+  0x8000000000000000 -> "yes"
+  _ -> "no"
+{-# NOINLINE f #-}
+
+main = do
+    let string = "0x8000000000000000"
+    let i = read string :: Integer
+    let i' = fromIntegral i :: Int
+    print i
+    print i'
+    print (f i')
diff --git a/testsuite/tests/codeGen/should_run/T10245.stdout b/testsuite/tests/codeGen/should_run/T10245.stdout
new file mode 100644 (file)
index 0000000..87a02ea
--- /dev/null
@@ -0,0 +1,3 @@
+9223372036854775808
+-9223372036854775808
+"yes"
diff --git a/testsuite/tests/codeGen/should_run/T10246.hs b/testsuite/tests/codeGen/should_run/T10246.hs
new file mode 100644 (file)
index 0000000..ab4a229
--- /dev/null
@@ -0,0 +1,32 @@
+f1 :: Int -> String
+f1 n = case n of
+  0 -> "bar"
+  0x10000000000000000 -> "foo"
+  _ -> "c"
+{-# NOINLINE f1 #-}
+
+g1 :: Int -> String
+g1 n = if n == 0 then "bar" else
+       if n == 0x10000000000000000 then  "foo" else
+       "c"
+{-# NOINLINE g1 #-}
+
+f2 :: Int -> String
+f2 n = case n of
+  0x10000000000000000 -> "foo"
+  0 -> "bar"
+  _ -> "c"
+{-# NOINLINE f2 #-}
+
+g2 :: Int -> String
+g2 n = if n == 0x10000000000000000 then  "foo" else
+       if n == 0 then "bar" else
+       "c"
+{-# NOINLINE g2 #-}
+
+main = do
+    let i = read "0" :: Int
+    print (f1 i)
+    print (g1 i)
+    print (f2 i)
+    print (g2 i)
diff --git a/testsuite/tests/codeGen/should_run/T10246.stdout b/testsuite/tests/codeGen/should_run/T10246.stdout
new file mode 100644 (file)
index 0000000..f073017
--- /dev/null
@@ -0,0 +1,4 @@
+"bar"
+"bar"
+"foo"
+"foo"
index 15c3476..41d18e5 100644 (file)
@@ -128,3 +128,5 @@ test('T9013', omit_ways(['ghci']),  # ghci doesn't support unboxed tuples
 test('T9340', normal, compile_and_run, [''])
 test('cgrun074', normal, compile_and_run, [''])
 test('CmmSwitchTest', when(fast(), skip), compile_and_run, [''])
+test('T10245', expect_broken(10246), compile_and_run, [''])
+test('T10246', expect_broken(10246), compile_and_run, [''])