From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4573 invoked by alias); 26 Jul 2010 16:11:42 -0000 Received: (qmail 4488 invoked by uid 48); 26 Jul 2010 16:11:23 -0000 Date: Mon, 26 Jul 2010 16:11:00 -0000 Subject: [Bug tree-optimization/45085] New: incorrect -Wuninitialized warning X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tromey at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02884.txt.bz2 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