------- Comment #5 from danglin at gcc dot gnu dot org  2007-07-24 19:22 -------
test01 is miscompiled at O2:

(gdb) disass _Z6test01v
Dump of assembler code for function _Z6test01v:
0x0001030c <_Z6test01v+0>:      ldi 7,ret0
0x00010310 <_Z6test01v+4>:      stw rp,-14(sp)
0x00010314 <_Z6test01v+8>:      ldo c0(sp),sp
0x00010318 <_Z6test01v+12>:     ldw -b0(sp),r21
0x0001031c <_Z6test01v+16>:     ldw -ac(sp),r22
0x00010320 <_Z6test01v+20>:     stw ret0,-b8(sp)
0x00010324 <_Z6test01v+24>:     ldi 1,ret0
0x00010328 <_Z6test01v+28>:     ldw -b8(sp),r19
0x0001032c <_Z6test01v+32>:     ldw -b4(sp),r20
0x00010330 <_Z6test01v+36>:     stw ret0,-ac(sp)
0x00010334 <_Z6test01v+40>:     stw r19,-98(sp)
0x00010338 <_Z6test01v+44>:     stw r20,-94(sp)
0x0001033c <_Z6test01v+48>:     ldw -98(sp),ret0
0x00010340 <_Z6test01v+52>:     stw r3,-88(sp)
0x00010344 <_Z6test01v+56>:     stw r0,-b4(sp)
0x00010348 <_Z6test01v+60>:     stw r19,-a8(sp)
0x0001034c <_Z6test01v+64>:     stw r20,-a4(sp)
0x00010350 <_Z6test01v+68>:     stw r21,-a0(sp)
0x00010354 <_Z6test01v+72>:     stw r22,-9c(sp)
0x00010358 <_Z6test01v+76>:     stw r0,-b0(sp)
0x0001035c <_Z6test01v+80>:     stw r21,-90(sp)
0x00010360 <_Z6test01v+84>:     stw r22,-8c(sp)
---Type <return> to continue, or q <return> to quit---
0x00010364 <_Z6test01v+88>:     cmpib,<> 7,ret0,0x1039c <_Z6test01v+144>
0x00010368 <_Z6test01v+92>:     ldw -a8(sp),ret0
0x0001036c <_Z6test01v+96>:     cmpib,<> 7,ret0,0x103bc <_Z6test01v+176>
0x00010370 <_Z6test01v+100>:    ldil L%a6800,r25
0x00010374 <_Z6test01v+104>:    b,l 0x1061c
<_ZN11__gnu_debug19_Safe_sequence_base13_M_detach_allEv>,rp
0x00010378 <_Z6test01v+108>:    ldo -94(sp),r26

The order of the ldw at 0x0001032c and the stw at 0x00010344 is
interchanged from what's in the O1 code.  As a result, r20 and the stack
slot at -94(sp) contain garbage.  Also, the ldw instructions at
0x00010318 and 0x0001031c are totally bogus.  Changing this
to a middle-end bug.


-- 

danglin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32878

Reply via email to