[Bug rtl-optimization/27625] New: invalid loop transformation.
ramana dot radhakrishnan at codito dot com
gcc-bugzilla@gcc.gnu.org
Tue May 16 10:42:00 GMT 2006
Number of loop iterations is calculated wrongly in the following bit of code.
extern char __dp0 ;
extern const long __reloc_table ;
extern const int __reloc_num ;
void
foo (void)
{
register char *dp = 0;
int cpu;
const long *reloc_ptr;
unsigned int num_relocs = 0;
dp = &__dp0;
for (reloc_ptr = &__reloc_table, num_relocs = (unsigned
int)&__reloc_num;num_relocs; reloc_ptr++,num_relocs--)
*(long *)(dp + *reloc_ptr) += (long)dp;
}
Code generated for :
./xgcc -B`pwd` -S -O3 -mregnames ~/tmp/fails.i
is
foo:
lis %r9,__dp0@ha
lis %r11,__reloc_table@ha
la %r8,__dp0@l(%r9)
lis %r9,__reloc_num@ha
la %r9,__reloc_num@l(%r9)
la %r11,__reloc_table@l(%r11)
mtctr %r9
mr %r10,%r8
.L4:
lwz %r9,0(%r11)
addi %r11,%r11,4
lwzx %r0,%r9,%r10
add %r0,%r0,%r8
stwx %r0,%r9,%r10
bdnz .L4
blr
This bug seems to appear after the ivopts backport. .08.jump has a check for
the loop counter to be 0 which 09.cse removes as trivially dead. I would expect
there to be a check for the loop counter to be zero before the body of the
loop.
--
Summary: invalid loop transformation.
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ramana dot radhakrishnan at codito dot com
GCC build triplet: i686-pc-linux
GCC host triplet: i686-pc-linux
GCC target triplet: powerpc-elf
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27625
More information about the Gcc-bugs
mailing list