This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]