summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2021-12-13 18:57:54 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-12-14 20:56:18 -0500
commit45bd630886157fbe4856594e098202808aedbdd0 (patch)
tree72aed98e9d6930af974adfded1d1b9722b8bd50c
parent34abbd81b75fb6ca381f0609257de6bf42471237 (diff)
downloadhaskell-45bd630886157fbe4856594e098202808aedbdd0.tar.gz
Test case from #19313
-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, [''])