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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to