[Bug middle-end/24129] [4.0 4.1 regression] bogus warning <var> is used uninitialized in this function

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Sep 29 20:35:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-29 20:35 -------
Lets look at the two functions:

static int
r_short(RFILE *p)
{ 
 register short x;
 x = ((p)->fp ? _IO_getc ((p)->fp) : (((p)->ptr != (p)->end) ? (unsigned char)*(p)->ptr++ : (-1)));
 x |= ((p)->fp ? _IO_getc ((p)->fp) : (((p)->ptr != (p)->end) ? (unsigned char)*(p)->ptr++ : (-1))) << 8;

 x |= -(x & 0x8000);
 return x;
}

int
PyMarshal_ReadShortFromFile(FILE *fp)
{
 WFILE rf;
 rf.fp = fp;
 rf.strings = ((void *)0);
 return r_short(&rf);
}

It is obvious that the warnings are valid as rf.end and rf.ptr is not initialized in 
PyMarshal_ReadShortFromFile.  There are no way to know that the arguments passing to 
PyMarshal_ReadShortFromFile are non null from the source you gave so the warning is correct.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list