[Bug tree-optimization/45085] New: incorrect -Wuninitialized warning
tromey at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jul 26 16:11:00 GMT 2010
I'm using a relatively recent svn trunk gcc on an x86 Fedora 13 machine.
I'm trying to compile gdb with it. I got this error:
../../archer/gdb/remote.c: In function Âremote_waitÂ:
../../archer/gdb/remote.c:5561:10: error: Âevent_ptid.tid may be used
uninitialized in this function [-Werror=uninitialized]
../../archer/gdb/remote.c:5561:10: error: Âevent_ptid.lwp may be used
uninitialized in this function [-Werror=uninitialized]
../../archer/gdb/remote.c:5561:10: error: Âevent_ptid.pid may be used
uninitialized in this function [-Werror=uninitialized]
cc1: all warnings being treated as errors
But the body of remote_wait is simple:
{
ptid_t event_ptid;
if (non_stop)
event_ptid = remote_wait_ns (ptid, status, options);
else
event_ptid = remote_wait_as (ptid, status, options);
if (target_can_async_p ())
{
/* If there are are events left in the queue tell the event loop
to return here. */
if (stop_reply_queue)
mark_async_event_handler (remote_async_inferior_event_token);
}
return event_ptid;
}
I thought perhaps that inlining was causing a problem (in which case this
error message is quite confusing, since it would point to the wrong function).
However, I added this:
memset (&event_ptid, 0, sizeof (event_ptid));
... to the function before the "if", and the error went away.
So, I think this is a gcc bug.
I will attach the .i file.
--
Summary: incorrect -Wuninitialized warning
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tromey at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45085
More information about the Gcc-bugs
mailing list