#2844: incorrect results when not compiling with optimisation
-------------------------------+--------------------------------------------
  Reporter:  igloo             |          Owner:                  
      Type:  bug               |         Status:  new             
  Priority:  high              |      Milestone:  6.12 branch     
 Component:  Compiler          |        Version:  6.11            
  Severity:  normal            |       Keywords:                  
Difficulty:  Unknown           |       Testcase:  random1283      
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-------------------------------+--------------------------------------------
 This is a cut-down `random1283`.

 `R.hs`:
 {{{
 module R (randomIO) where

 class Num a => Random a where
     randomIO :: IO a

 instance Random Int where
     randomIO = return 10003
 }}}

 `s.hs`:
 {{{
 import R

 main :: IO ()
 main = do r >>= print
           r >>= print

 r :: IO Int
 r = randomIO
 }}}

 {{{
 $ rm *.o *.hi s
 $ ghc -c R.hs
 $ ghc s.hs R.o -o s
 $ ./s
 -4611686018427387865
 -4611686018427387865
 $ rm *.o *.hi s
 $ ghc -c R.hs
 $ ghc s.hs R.o -o s -O
 $ ./s
 10003
 10003
 $ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.11.20081205
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2844>
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

Reply via email to