[Bug tree-optimization/21548] [4.0 regression] Wrong warning about uninitialized variable
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri May 13 22:23:00 GMT 2005
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-05-13 22:23 -------
thinking again out loud:
The function could be changed to (which we seem to be missing on the mainline):
static int blocksize = 4096;
int bar (int);
void foo (void)
{
int toread;
int bytes;
static char eof_reached = 0;
toread = blocksize;
while (1)
{
bytes = bar (toread);
if (bytes <= 0)
{
if (bytes < 0)
continue;
goto temp;
}
toread -= bytes;
if (toread == 0)
goto temp1;
}
if (bytes == 0)
temp:
eof_reached = 1;
temp1:
}
So comming out of the loop bytes will be zero if we break out of it but otherwise cannot, so we can skip
if statement. This is a missing optimization on the mainline (someone should look into it) but now my
comment #10 becomes true and we see that it is always used as uninitized.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21548
More information about the Gcc-bugs
mailing list