public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/45085]  New: incorrect -Wuninitialized warning
@ 2010-07-26 16:11 tromey at gcc dot gnu dot org
  2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: tromey at gcc dot gnu dot org @ 2010-07-26 16:11 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1812 bytes --]

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-09-03  9:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 16:11 [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning tromey at gcc dot gnu dot org
2010-07-26 16:13 ` [Bug tree-optimization/45085] " tromey at gcc dot gnu dot org
2010-07-27 12:42 ` jakub at gcc dot gnu dot org
2010-07-27 12:58 ` jakub at gcc dot gnu dot org
2010-07-27 13:25 ` [Bug tree-optimization/45085] [4.6 Regression] " jakub at gcc dot gnu dot org
2010-07-27 14:13 ` hubicka at gcc dot gnu dot org
2010-08-03 12:09 ` hubicka at gcc dot gnu dot org
2010-09-02 11:11 ` rguenth at gcc dot gnu dot org
2010-09-02 22:59 ` manu at gcc dot gnu dot org
2010-09-03  9:11 ` jakub at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).