diff options
Diffstat (limited to 'testsuite/tests/codeGen/should_run/cgrun060.hs')
-rw-r--r-- | testsuite/tests/codeGen/should_run/cgrun060.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/tests/codeGen/should_run/cgrun060.hs b/testsuite/tests/codeGen/should_run/cgrun060.hs new file mode 100644 index 0000000000..a7558029d4 --- /dev/null +++ b/testsuite/tests/codeGen/should_run/cgrun060.hs @@ -0,0 +1,18 @@ +-- tickled a bug in stack squeezing in 6.8.2. unsafePerformIO calls +-- noDuplicate#, which marks the update frames on the stack, and was +-- preventing subsequent update frames from being collapsed with the +-- marked frame. + +module Main where + +import System.IO.Unsafe + +main = print (sim (replicate 100000 ())) + +sim [] = True +sim (_:xs) = badStack (sim xs) + +goodStack x = fromJust (Just x) --no stack overflow +badStack x = unsafePerformIO (return x) --stack overflow + +fromJust (Just x) = x |