Commit 1df97797 authored by's avatar
Browse files

add test for unsafePerformIO/stack overflow

parent 1e4335ae
......@@ -64,3 +64,5 @@ test('cg059', exit_code(1), compile_and_run, [''])
test('1852', normal, compile_and_run, [''])
test('2080', normal, compile_and_run, [''])
test('cg060', extra_run_opts('+RTS -K64k -RTS'), compile_and_run, [''])
-- 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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment