Created
October 12, 2015 22:30
-
-
Save nkaretnikov/6f85d5a98e72cd4b51ca to your computer and use it in GitHub Desktop.
subWordC test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/testsuite/tests/numeric/should_run/T10962.hs b/testsuite/tests/numeric/should_run/T10962.hs | |
new file mode 100644 | |
index 0000000..896c9e9 | |
--- /dev/null | |
+++ b/testsuite/tests/numeric/should_run/T10962.hs | |
@@ -0,0 +1,16 @@ | |
+{-# LANGUAGE MagicHash #-} | |
+{-# LANGUAGE UnboxedTuples #-} | |
+ | |
+module Main where | |
+ | |
+import GHC.Base | |
+ | |
+main :: IO () | |
+main = do | |
+ -- Overflow. | |
+ let (# w1, i1 #) = subWordC# 1## 3## | |
+ print (W# w1, I# i1) | |
+ | |
+ -- No overflow. | |
+ let (# w2, i2 #) = subWordC# 3## 1## | |
+ print (W# w2, I# i2) | |
diff --git a/testsuite/tests/numeric/should_run/T10962.stdout b/testsuite/tests/numeric/should_run/T10962.stdout | |
new file mode 100644 | |
index 0000000..853bf94 | |
--- /dev/null | |
+++ b/testsuite/tests/numeric/should_run/T10962.stdout | |
@@ -0,0 +1,2 @@ | |
+(18446744073709551614,1) | |
+(2,0) | |
diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T | |
index 27dccc7..58aa187 100644 | |
--- a/testsuite/tests/numeric/should_run/all.T | |
+++ b/testsuite/tests/numeric/should_run/all.T | |
@@ -64,3 +64,4 @@ test('T8726', normal, compile_and_run, ['']) | |
test('CarryOverflow', omit_ways(['ghci']), compile_and_run, ['']) | |
test('T9810', normal, compile_and_run, ['']) | |
test('T10011', normal, compile_and_run, ['']) | |
+test('T10962', normal, compile_and_run, ['']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment