#3279: Segmentation fault in reactive program
-------------------------------+--------------------------------------------
Reporter: Baughn | Owner: simonmar
Type: bug | Status: new
Priority: high | Milestone: 6.12.1
Component: Runtime System | Version: 6.11
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: x86_64 (amd64) |
-------------------------------+--------------------------------------------
Comment (by int-e):
Here's a testcase for you. It does not crash, but it prints wrong results
(112459785 instead of 2 here; Baughn tested it on a 64 bit maching and got
1114609665). I've also verified that your patch to {{{unblock}}} fixes
this behaviour.
{{{
-- test for #3279
import System.IO.Unsafe
import GHC.Conc
import Control.Exception
import Prelude hiding (catch)
f :: Int
f = (1 +) . unsafePerformIO $ do
error "foo" `catch` \(SomeException e) -> do
myThreadId >>= flip throwTo e
-- point X
unblock $ return 1
main :: IO ()
main = do
evaluate f `catch` \(SomeException e) -> return 0
-- the evaluation of 'x' is now suspended at point X
tid <- block $ forkIO (evaluate f >> return ())
killThread tid
-- now execute the 'unblock' above with a pending exception
yield
-- should print 1 + 1 = 2
print f
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3279#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs