Mail Archives: pgcc/1999/09/16/19:41:12
PGCC generates incorrect code for the file pgcc_bug.c when invoked with
the following options:
pgcc -S -O -fstrength-reduce -fcompare-elim pgcc_bug.c
== pgcc_bug.c
int main(void)
{
int i;
int h[3];
h[0]=0;
for (i=0; i<2; i++)
h[i+1]=h[i];
return 0;
}
The following assembly output is produced:
== pgcc_bug.s
.file "pgcc_bug.c"
.version "01.01"
gcc2_compiled.:
.text
.align 16
.globl main
.type main,@function
main:
pushl %ebp
movl %esp,%ebp
subl $52,%esp
pushl %ebx
movl $0,-32(%ebp)
movl $-2,%edx
leal -32(%ebp),%ebx
movl $4,%ecx
.p2align 4,,7
.L6:
movl 8(%ebx,%edx,4),%eax
movl %eax,(%ecx,%ebx)
addl $4,%ecx
addl $3,%edx
jne .L6
xorl %eax,%eax
popl %ebx
movl %ebp,%esp
popl %ebp
ret
.Lfe1:
.size main,.Lfe1-main
.ident "GCC: (GNU) pgcc-2.95.1 19990816 (release)"
I am using PGCC 2.95.1 under Linux 2.2.12 on a Pentium Pro.
--
Simon Taylor
- Raw text -