This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion
- From: "rsandifo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2004 08:40:38 -0000
- Subject: [Bug rtl-optimization/16380] New: Use of uninitialised register after dbra conversion
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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