This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21548] [4.0 regression] Wrong warning about uninitialized variable
- From: "pinskia 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 22:23:38 -0000
- Subject: [Bug tree-optimization/21548] [4.0 regression] Wrong warning about uninitialized variable
- References: <20050513144556.21548.schwab@suse.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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