[Bug middle-end/13832] New: [tree-ssa] dom-pass produces wrong code
spop at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Jan 23 15:40:00 GMT 2004
Hi,
As described in
http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02440.html
the following testcase produces wrong code when compiled with tree-ssa:
int main(void)
{
int a = 0;
int b;
while (a < 50)
{
for (b = 0; b < 10; b++)
{
a++;
}
a++;
}
}
Attached the assembler output of "-O2 -S" on i686-pc-linux-gnu
for the branch tree-ssa-lno and for gcc-3.3.2:
.file "foo.c"
.text
.p2align 2,,3
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
subl $16, %esp
xorl %ecx, %ecx
.L2:
xorl %eax, %eax
jmp .L3
.p2align 2,,3
.L8:
movl %edx, %ecx
.L3:
incl %eax
cmpl $9, %eax
leal 1(%ecx), %edx
jle .L8
addl $2, %ecx
cmpl $49, %ecx
jle .L2
leave
ret
.size main, .-main
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.5-tree-ssa-lno 20040121 (merged 20040120)"
.file "foo.c"
.text
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
movl $0, %eax
subl %eax, %esp
movl $0, -4(%ebp)
.L2:
cmpl $49, -4(%ebp)
jle .L4
jmp .L3
.L4:
movl $0, -8(%ebp)
.L5:
cmpl $9, -8(%ebp)
jle .L8
jmp .L6
.L8:
leal -4(%ebp), %eax
incl (%eax)
leal -8(%ebp), %eax
incl (%eax)
jmp .L5
.L6:
leal -4(%ebp), %eax
incl (%eax)
jmp .L2
.L3:
leave
ret
.size main, .-main
.section .note.GNU-stack,"",@progbits
.ident "GCC: (GNU) 3.3.2 (Debian)"
--
Summary: [tree-ssa] dom-pass produces wrong code
Product: gcc
Version: tree-ssa
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: spop at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org,law at redhat dot
com,pop at gauvain dot u-strasbg dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13832
More information about the Gcc-bugs
mailing list