summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/tests/stranal/should_run/T12368a.hs27
-rw-r--r--testsuite/tests/stranal/should_run/T12368a.stderr3
2 files changed, 30 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_run/T12368a.hs b/testsuite/tests/stranal/should_run/T12368a.hs
new file mode 100644
index 0000000000..301d044493
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T12368a.hs
@@ -0,0 +1,27 @@
+-- Needs to be a product type
+data Stream = S Int Stream
+
+-- a is wrongly recorded abstent if the non-lazy-fv from foo are thrown away.
+bar :: Int -> Int -> Stream -> Int
+bar a n s = foo n s
+ where
+ -- Non terminating local rec, strict in a
+ foo :: Int -> Stream -> Int
+ foo 0 (S n s) = a
+ foo i (S n s) = a `seq` n + foo (i-1) s
+{-# NOINLINE bar #-}
+
+
+baz :: Int -> Int -> Int
+baz 0 not_absent = 0
+baz 1 not_absent = baz 2 not_absent
+baz x not_absent = bar not_absent 1000 arg
+ where
+ arg = S 1 arg
+
+bamf x = baz x (error "This is good!")
+{-# NOINLINE bamf #-}
+
+
+main :: IO ()
+main = bamf 10 `seq` return ()
diff --git a/testsuite/tests/stranal/should_run/T12368a.stderr b/testsuite/tests/stranal/should_run/T12368a.stderr
new file mode 100644
index 0000000000..98246d33d0
--- /dev/null
+++ b/testsuite/tests/stranal/should_run/T12368a.stderr
@@ -0,0 +1,3 @@
+T12368a: This is good!
+CallStack (from HasCallStack):
+ error, called at T12368a.hs:22:17 in main:Main