Different behaviour with -O in concurrent program
Mitar (mmitar@gmail.com) reports I am attaching a program which locks (throws an exception <<loop>>) when compiled like:
ghc --make -threaded -main-is Test.main Test.hs -o test-no-opt -package mtl
and doesn't loop when compiled with
ghc --make -threaded -O2 -main-is Test.main Test.hs -o test-opt -package mtl
This should probably not happen.
I am using 6.12.3 on Linux x86_64.
SimonPJ reproduced this with the HEAD:
simonpj@cam-04-unx:~/tmp$ ./test-opt
42
42
42
42
-- Ctrl-C out
simonpj@cam-04-unx:~/tmp$ ./test-no-opt
42
test-no-opt: <<loop>>
/bin/bash: line 0: echo: write error: Broken pipe
/bin/bash: line 0: echo: write error: Broken pipe
/bin/bash: line 0: echo: write error: Broken pipe
-- Ctrl-C out
It's not 100% clear that it's a bug, but Simon M will look at it.