This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21562] New: Quiet bad codegen (unrolling + tail call interaction)
- From: "dalej at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 May 2005 23:56:22 -0000
- Subject: [Bug tree-optimization/21562] New: Quiet bad codegen (unrolling + tail call interaction)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Compile the following with -O2 -funroll-loops and you get bad codegen. An uninitilaized value
is used as "pos" in computing the store address for mr[pos]=1 at the top of the function. The
first dump where it's wrong seems to be "nrv". If you unroll by hand it comes out correct.
extern int delta[8];
extern unsigned char board[421];
void
ping_recurse(int pos, int mr[400], int color)
{
int k;
mr[pos] = 1;
for (k = 0; k < 4; k++) {
int apos = pos + delta[k];
if (mr[apos] == 1 || board[apos] == color)
ping_recurse(apos, mr, color);
}
}
Beginning of codegen on darwin8:
_ping_recurse:
mflr r0
bcl 20,31,"L00000000001$pb"
"L00000000001$pb":
stmw r28,-16(r1)
mr r29,r4
mflr r31
mr r28,r5
stw r0,8(r1)
stwu r1,-80(r1)
L25:
addis r11,r31,ha16(L_delta$non_lazy_ptr-"L00000000001$pb")
slwi r2,r30,2 <<<< R30 uninitiailized
--
Summary: Quiet bad codegen (unrolling + tail call interaction)
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dalej at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: powerpc-apple-darwin8.0.0
GCC host triplet: powerpc-apple-darwin8.0.0
GCC target triplet: powerpc-apple-darwin8.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21562