[GHC] #11702: Constant folding on 'mod/Word' - incorrect result

GHC ghc-devs at haskell.org
Tue Aug 23 14:22:00 UTC 2016


#11702: Constant folding on 'mod/Word' - incorrect result
-------------------------------------+-------------------------------------
        Reporter:  ondrap            |                Owner:  bgamari
            Type:  bug               |               Status:  closed
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Prelude           |              Version:  7.10.3
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect result  |  Unknown/Multiple
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2004
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hjarvi):

 On my x64 the given test case goes through without a problem on GHC7.10
 and GHC8.0, but I find a more effective test case to be (produces "5 0" on
 GHC7.10.3 and GHC8.0.0.20160302. The correct result "0 0" is produced by
 GHC 7.6.3 and GHC 8.0.1.20160822):


 {{{
 -- -*- haskell -*-

 module Main
 ( main )
 where

 import Data.IORef
 import Data.Word

 main = do
   i <- newIORef (5 :: Word) >>= readIORef
   print $ i `mod` 1
   print $ (5 :: Word) `mod` 1

 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11702#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list