
23 Jan
2009
23 Jan
'09
12:39 p.m.
Ertugrul Soeylemez wrote:
And to prove that IORefs do lead to a pointer race condition and hence are insecure, try the following code:
main :: IO () main = do ref <- newIORef False forkIO $ forever $ modifyIORef ref not forever $ readIORef ref >>= print
It crashes for me. I'm using GHC 6.10.1 on an Athlon 64 X2 (32 bits system). The error message reads:
test: internal error: schedule: invalid what_next field (GHC version 6.10.1 for i386_unknown_linux) Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Interesting. Looks like a bug in the single-threaded runtime to me: I can reproduce this crash only when compiling without the `-threaded' flag.