Commit d58cfad4 authored by Simon Marlow's avatar Simon Marlow
Browse files

add a test for a blackhole GC bug

parent 0cc16ab2
......@@ -125,3 +125,4 @@ test('conc054', normal, compile_and_run, ['-package stm'])
test('conc055', exit_code(1), compile_and_run, ['-package stm'])
test('conc056', only_ways(['threaded1','threaded2']), compile_and_run, ['-package stm -package network'])
test('conc057', only_ways(['threaded2']), compile_and_run, ['-O0'])
-- test for a bug in blackhole handling in the garbage collector,
-- fixed on 7/4/2006. The symptom is that stdout gets finalized too
-- early, and the main thread fails when writing to it. Only happens
-- with +RTS -N2, and must be compiled without optimisation.
module Main (main) where
import Control.Parallel.Strategies
import Control.Exception
f x 0 = x
f x y = f ((x+y)-y) (y-1)
bigcomputation :: Int -> Int
bigcomputation x = f x 50000
main = do
let seeds = [1..12]
let seeds2 = map bigcomputation seeds
mapM (\v -> putStr ((show v) ++ " " )) seeds
putStr "\n"
evaluate (seeds2 `using` parList rwhnf)
mapM (\v -> putStr ((show v) ++ " " )) seeds2
putStr "\n"
1 2 3 4 5 6 7 8 9 10 11 12
1 2 3 4 5 6 7 8 9 10 11 12
Markdown is supported
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