summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2021-12-13 18:57:54 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2021-12-13 18:57:54 +0100
commit56186b8f2c48b717a891a77a94bdd51815f5ef65 (patch)
treebee33f7d95a91d3f458085ee54490952ad136543
parent401ddd5300c8be2ee03bf040146e7f2878bae0a9 (diff)
downloadhaskell-joachim/wip/T19131-test.tar.gz
Test case from #19313joachim/wip/T19131-test
-rw-r--r--testsuite/tests/simplCore/should_run/T19313.hs17
-rw-r--r--testsuite/tests/simplCore/should_run/T19313.stdout1
-rw-r--r--testsuite/tests/simplCore/should_run/all.T3
3 files changed, 20 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_run/T19313.hs b/testsuite/tests/simplCore/should_run/T19313.hs
new file mode 100644
index 0000000000..0297260f79
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T19313.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE MagicHash #-}
+module Main where
+
+import GHC.Exts
+
+{-# NOINLINE up #-}
+up :: Int# -> Int#
+up x = x +# 1#
+
+{-# NOINLINE down #-}
+down :: Int# -> Int#
+down x = x -# 1#
+
+{-# RULES "up/down" forall x. up (down x) = 42# #-}
+
+main = do
+ print (I# (up (down 1#)))
diff --git a/testsuite/tests/simplCore/should_run/T19313.stdout b/testsuite/tests/simplCore/should_run/T19313.stdout
new file mode 100644
index 0000000000..d81cc0710e
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T19313.stdout
@@ -0,0 +1 @@
+42
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index fe6b5d3479..ac758668ab 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -98,4 +98,5 @@ test('NumConstantFolding16', normal, compile_and_run, [''])
test('NumConstantFolding32', normal, compile_and_run, [''])
test('NumConstantFolding', normal, compile_and_run, [''])
test('T19413', normal, compile_and_run, [''])
-test('T20203', normal, compile, ['-O -dsuppress-all -dsuppress-uniques -dno-typeable-binds -ddump-simpl']) \ No newline at end of file
+test('T20203', normal, compile, ['-O -dsuppress-all -dsuppress-uniques -dno-typeable-binds -ddump-simpl'])
+test('T19313', expect_broken(19131), compile_and_run, [''])