The following astonishing piece of code should calculate bottom:  :-)

----------------------------------------
import IOExts
loop r = loop r >> writeIORef r 42
main = newIORef 0 >>= loop
----------------------------------------

Using GHC-3.03 on Linux *wihtout* -O, eveything is "fine":


   panne@liesl: > ghc -Wall -fglasgow-exts Main.hs
   ghc: module version changed to 1; reason: no old .hi file
   panne@liesl: > ./a.out 
   Stack space overflow: current size 262152 bytes.
   Use `+RTS -Ksize' to increase it.

But with -O something weird happens:

   panne@liesl: > ghc -Wall -fglasgow-exts -O Main.hs
   ghc: module version changed to 1; reason: no old .hi file
   panne@liesl: > ./a.out

   Fail: newVar: Shouldn't access `bounds' of a MutableVar

I didn't mention `bounds' anywhere...

Cheers,
   Sven

-- 
Sven Panne                                        Tel.: +49/89/2178-2235
LMU, Institut fuer Informatik                     FAX : +49/89/2178-2211
LFE Programmier- und Modellierungssprachen              Oettingenstr. 67
mailto:[EMAIL PROTECTED]            D-80538 Muenchen
http://www.pms.informatik.uni-muenchen.de/mitarbeiter/panne

Reply via email to