This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/12312] [3.4 regression] Bootstrap fails compiling unwind-dw2.c


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From danglin at gcc dot gnu dot org  2003-09-17 17:53 -------
The fault occurs in stmt.c.  The following testcase shows the
problem:

extern int test (void);
void
foo (int i)
{
  while (1)
    {
      if (!check ())
        i--;
      i--;
      if (i <= 0)
        break;
    }
}

The assembler output generated at -O2 is:

.globl foo
        .type   foo, @function
foo:
        .PROC
        .CALLINFO FRAME=64,CALLS,SAVE_RP,ENTRY_GR=3
        .ENTRY
        stw %r2,-20(%r30)
        stwm %r3,64(%r30)
        copy %r26,%r3
.L2:
        bl check,%r2
        nop
        comiclr,= 0,%r28,%r0
        addi 1,%r3,%r3
        comib,< 0,%r3,.L2
        ldw -84(%r30),%r2
        bv %r0(%r2)
        ldwm -64(%r30),%r3

We have lost the second "i--;" and the first has mysteriously
changed to an addition of 1.  Combine seems to go seriously
wrong with this rtl from the life pass:

(insn 20 19 55 1 (set (reg:SI 95)
        (reg:SI 28 %r28)) 37 {*pa.md:2265} (insn_list 19 (nil))
    (expr_list:REG_DEAD (reg:SI 28 %r28)
        (nil)))

(insn 55 20 56 1 (set (reg:SI 98)
        (eq:SI (reg:SI 95)
            (const_int 0 [0x0]))) 4 {scc} (insn_list 20 (nil))
    (expr_list:REG_DEAD (reg:SI 95)
        (nil)))

(insn 56 55 27 1 (set (reg/v:SI 94 [ i ])
        (minus:SI (reg/v:SI 94 [ i ])
            (reg:SI 98))) 123 {*pa.md:4013} (insn_list 55 (nil))
    (expr_list:REG_DEAD (reg:SI 98)
        (nil)))

(insn 27 56 29 1 (set (reg/v:SI 94 [ i ])
        (plus:SI (reg/v:SI 94 [ i ])
            (const_int -1 [0xffffffff]))) 121 {addsi3} (insn_list 56 (nil))
    (nil))

which it changes to

(note 20 19 55 1 NOTE_INSN_DELETED)

(note 55 20 56 1 NOTE_INSN_DELETED)

(note 56 55 27 1 NOTE_INSN_DELETED)

(insn 27 56 29 1 (set (reg/v:SI 94 [ i ])
        (plus:SI (ne:SI (reg:SI 28 %r28)
                (const_int 0 [0x0]))
            (reg/v:SI 94 [ i ]))) 10 {incscc} (insn_list 19 (nil))
    (expr_list:REG_DEAD (reg:SI 28 %r28)
        (nil)))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]