[commit: ghc] master: Test case for #10246 (8f07092)

git at git.haskell.org git at git.haskell.org
Mon Apr 6 07:38:19 UTC 2015


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8f0709249826dd2eda9bf53be89f176a4f30c81f/ghc

>---------------------------------------------------------------

commit 8f0709249826dd2eda9bf53be89f176a4f30c81f
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Apr 6 09:37:42 2015 +0200

    Test case for #10246
    
    still marked known_broken. This also adds the test case for #10245,
    which should pass once #10246 is fixed.


>---------------------------------------------------------------

8f0709249826dd2eda9bf53be89f176a4f30c81f
 testsuite/tests/codeGen/should_run/T10245.hs     | 13 ++++++++++
 testsuite/tests/codeGen/should_run/T10245.stdout |  3 +++
 testsuite/tests/codeGen/should_run/T10246.hs     | 32 ++++++++++++++++++++++++
 testsuite/tests/codeGen/should_run/T10246.stdout |  4 +++
 testsuite/tests/codeGen/should_run/all.T         |  2 ++
 5 files changed, 54 insertions(+)

diff --git a/testsuite/tests/codeGen/should_run/T10245.hs b/testsuite/tests/codeGen/should_run/T10245.hs
new file mode 100644
index 0000000..7094a1d
--- /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 0000000..87a02ea
--- /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 0000000..ab4a229
--- /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 0000000..f073017
--- /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 15c3476..41d18e5 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, [''])



More information about the ghc-commits mailing list