#6156: Optimiser bug on linux-powerpc
------------------------------------------+---------------------------------
  Reporter:  erikd                        |          Owner:  igloo  
      Type:  bug                          |         Status:  new    
  Priority:  normal                       |      Milestone:  7.6.1  
 Component:  Compiler                     |        Version:  7.4.1  
Resolution:                               |       Keywords:         
        Os:  Linux                        |   Architecture:  powerpc
   Failure:  Incorrect result at runtime  |     Difficulty:  Unknown
  Testcase:                               |      Blockedby:         
  Blocking:                               |        Related:         
------------------------------------------+---------------------------------

Comment(by erikd):

 I'll continuue gathering more data. Latest point of interest is this code:

 {{{
 import GHC.Word
 import Numeric
 main :: IO ()
 main = putStrLn (showHex (succ (0xa1a2a3a4ffffffff :: Word64)) "")
 }}}

 Compiled with `-O1 -fno-enable-rewrite-rules` this produces th correct
 result of `a1a2a3a500000000`, but just a plain `-O1` this results in:

 {{{
 Enum.succ{Word64}: tried to take `succ' of maxBound
 }}}

 which is rather weird. Its complaining about the least significant Word32
 of the Word64 being equal to maxBound (which I'm assuming is the 32 bit
 maxBound). Something there seems very wrong.

 I've been looking at a lot of the dump files as well. In the case of the
 code above, I've been looking for invocations of `succ` and get for
 instance this in `dump-prep`:

 {{{
 Main.main_w :: GHC.Word.Word64
 [GblId, Caf=NoCafRefs, Unf=OtherCon []]
 Main.main_w = GHC.Word.W64# (__word64 16)

 Main.main3 :: GHC.Word.Word64
 [GblId]
 Main.main3 = GHC.Word.$w$csucc (__word64 11647051515398455295)

 Main.main2 :: GHC.Base.String
 [GblId]
 Main.main2 =
   Numeric.$wshowIntAtBase
     @ GHC.Word.Word64
     GHC.Word.$fRealWord64
     GHC.Word.$fIntegralWord64_$cquotRem
     GHC.Word.$fEnumWord64_$ctoInteger
     GHC.Word.$fShowWord64
     Main.main_w
     GHC.Show.intToDigit
     Main.main3
     (GHC.Types.[] @ GHC.Types.Char)
 }}}

 Debugging continues.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to