public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion
@ 2004-07-06  8:40 rsandifo at gcc dot gnu dot org
  2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rsandifo at gcc dot gnu dot org @ 2004-07-06  8:40 UTC (permalink / raw)
  To: gcc-bugs

gcc-3.0 and above miscompile the following test case on mips64-elf
at -O2:

int main ()
{
  int i;
  for (i = 0; i < 10; i++)
    continue;
  if (i < 10)
    abort ();
  exit (0);
}

GCSE realises that the second i < 10 is redundant and reuses
the result of "i < 10" from the for(...) loop.  The loop
optimiser then converts the loop into decrement-and-branch
form and deletes the first comparison.  This leaves the
if (...) statement checking an uninitialised register:

        addiu   $sp,$sp,-40
        sd      $31,32($sp)
        li      $2,9
        addiu   $2,$2,-1
$L10:
        bgez    $2,$L10
        addiu   $2,$2,-1

        beq     $3,$0,$L6      # <---- $3 not initialised
        nop

        jal     abort
        nop

$L6:
        jal     exit
        move    $4,$0

-- 
           Summary: Use of uninitialised register after dbra conversion
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: rtl-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rsandifo at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: mips64-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16380


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

end of thread, other threads:[~2004-07-13 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-06  8:40 [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion rsandifo at gcc dot gnu dot org
2004-07-06  8:42 ` [Bug rtl-optimization/16380] " rsandifo at gcc dot gnu dot org
2004-07-06 18:27 ` cvs-commit at gcc dot gnu dot org
2004-07-06 20:02 ` [Bug rtl-optimization/16380] [3.3/3.4 Regression] " pinskia at gcc dot gnu dot org
2004-07-13 15:29 ` cvs-commit at gcc dot gnu dot org
2004-07-13 15:31 ` rsandifo 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).