#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):

 New example:

 {{{
 import GHC.Word
 import Numeric

 main :: IO ()
 main = putStrLn (showHex (incr (0xa1a2a3a4a5a6a7a8 :: Word64)) "")

 incr :: Word64 -> Word64
 incr x = x + 1
 }}}

 results in the following optimised C-- code:

 {{{
     c1PM:
         I32[Sp - 8] = stg_bh_upd_frame_info;
         I32[Sp - 4] = Hp - 4;
         I64[Sp - 16] = 1 :: W64;
         I64[Sp - 24] = 11647051513882650536 :: W64;
         Sp = Sp - 24;
         jump GHC.Word.$w$c+_info; // []
 }}}

 which gets converted to the following assembler:

 {{{
 _c1PM:
         lis     31, stg_bh_upd_frame_info@ha
         addi    31, 31, stg_bh_upd_frame_info@l
         stw     31, -8(22)
         addi    31, 25, -4
         stw     31, -4(22)
         lis     31, 0
         ori     31, 31, 1
         lis     30, 0
         ori     31, 31, 0
         stw     31, -12(22)
         stw     30, -16(22)
         lis     31, 0
         ori     31, 31, 42920
         lis     30, 0
         ori     31, 31, 0
         stw     31, -20(22)
         stw     30, -24(22)
         addi    22, 22, -24
         b       GHC.Word.$w$c+_info
 }}}

 The assembler looks correct suggesting that the only thing that could be
 going wrong is the function `GHC.Word.$w$c+_info`.

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