public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/21562] New: Quiet bad codegen (unrolling + tail call interaction)
@ 2005-05-13 23:56 dalej at gcc dot gnu dot org
  2005-05-14  0:24 ` [Bug tree-optimization/21562] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: dalej at gcc dot gnu dot org @ 2005-05-13 23:56 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-08-18  9:51 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-13 23:56 [Bug tree-optimization/21562] New: Quiet bad codegen (unrolling + tail call interaction) dalej at gcc dot gnu dot org
2005-05-14  0:24 ` [Bug tree-optimization/21562] [4.0/4.1 Regression] " pinskia at gcc dot gnu dot org
2005-05-14  0:41 ` pinskia at gcc dot gnu dot org
2005-05-14  0:47 ` pinskia at gcc dot gnu dot org
2005-05-16 21:45 ` dalej at gcc dot gnu dot org
2005-05-16 22:54 ` pinskia at gcc dot gnu dot org
2005-05-26 23:33 ` pinskia at gcc dot gnu dot org
2005-05-28 23:48 ` cvs-commit at gcc dot gnu dot org
2005-06-07  7:51 ` [Bug tree-optimization/21562] [4.0 " steven at gcc dot gnu dot org
2005-06-07 11:42 ` pinskia at gcc dot gnu dot org
2005-06-26  1:53 ` mmitchel at gcc dot gnu dot org
2005-06-28  1:29 ` hubicka at ucw dot cz
2005-07-06 16:15 ` mmitchel at gcc dot gnu dot org
2005-07-06 17:04 ` mmitchel at gcc dot gnu dot org
2005-08-05 17:51 ` cvs-commit at gcc dot gnu dot org
2005-08-18  9:51 ` bonzini at gcc dot gnu dot org
2005-08-18 10:11 ` cvs-commit at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).