summaryrefslogtreecommitdiff
path: root/testsuite/tests/simplCore/should_compile/T4957.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/simplCore/should_compile/T4957.hs')
-rw-r--r--testsuite/tests/simplCore/should_compile/T4957.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T4957.hs b/testsuite/tests/simplCore/should_compile/T4957.hs
new file mode 100644
index 0000000000..63086cd78d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T4957.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE MagicHash #-}
+module T4957 where
+
+import GHC.Base
+
+f :: Bool -> Int -> Int
+f b 0 = 0
+f b x = let y = case b of
+ True -> case f b (x-1) of
+ I# v -> I# (v -# 1#)
+ False -> case f b (x-1) of
+ I# v -> I# (v +# 1#)
+ in
+ case b of
+ True -> case y of
+ I# w -> I# (w -# 1#)
+
+ False -> case y of
+ I# w -> I# (w +# 1#)