summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-04-06 09:37:42 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2015-04-06 09:37:42 +0200
commit8f0709249826dd2eda9bf53be89f176a4f30c81f (patch)
tree2c5f6ca010aeb2e6146252f46ded9e6013ab179a /testsuite
parenta838d1f7c668f6c5886ce350cb456f3ecbcb1499 (diff)
downloadhaskell-8f0709249826dd2eda9bf53be89f176a4f30c81f.tar.gz
Test case for #10246
still marked known_broken. This also adds the test case for #10245, which should pass once #10246 is fixed.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/codeGen/should_run/T10245.hs13
-rw-r--r--testsuite/tests/codeGen/should_run/T10245.stdout3
-rw-r--r--testsuite/tests/codeGen/should_run/T10246.hs32
-rw-r--r--testsuite/tests/codeGen/should_run/T10246.stdout4
-rw-r--r--testsuite/tests/codeGen/should_run/all.T2
5 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs
new file mode 100644
index 0000000000..7094a1d1af
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T10245.hs
@@ -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
index 0000000000..87a02ea3c6
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T10245.stdout
@@ -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
index 0000000000..ab4a229a9d
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T10246.hs
@@ -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
index 0000000000..f073017b5a
--- /dev/null
+++ b/testsuite/tests/codeGen/should_run/T10246.stdout
@@ -0,0 +1,4 @@
+"bar"
+"bar"
+"foo"
+"foo"
diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T
index 15c3476cc5..41d18e5cef 100644
--- a/testsuite/tests/codeGen/should_run/all.T
+++ b/testsuite/tests/codeGen/should_run/all.T
@@ -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, [''])