From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26913 invoked by alias); 31 Mar 2011 14:43:08 -0000 Received: (qmail 26903 invoked by uid 22791); 31 Mar 2011 14:43:07 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,MAY_BE_FORGED,SPF_SOFTFAIL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e32.co.us.ibm.com (HELO e32.co.us.ibm.com) (32.97.110.150) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 31 Mar 2011 14:43:01 +0000 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e32.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id p2VEW9fH012309 for ; Thu, 31 Mar 2011 08:32:09 -0600 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p2VEgsFR051986 for ; Thu, 31 Mar 2011 08:42:55 -0600 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p2VEgrvI027940 for ; Thu, 31 Mar 2011 08:42:53 -0600 Received: from [9.18.235.101] (dyn531364.br.ibm.com [9.18.235.101] (may be forged)) by d03av04.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p2VEgpIb027790; Thu, 31 Mar 2011 08:42:52 -0600 Subject: Re: [commit] Fix uninitialized warning (Re: [RFA] Refactor breakpoint_re_set_one) From: Thiago Jung Bauermann To: Ulrich Weigand Cc: Joel Brobecker , gdb-patches ml In-Reply-To: <201103311123.p2VBNFKn020306@d06av02.portsmouth.uk.ibm.com> References: <201103311123.p2VBNFKn020306@d06av02.portsmouth.uk.ibm.com> Content-Type: text/plain; charset="UTF-8" Date: Thu, 31 Mar 2011 15:03:00 -0000 Message-ID: <1301582570.9154.10.camel@hactar> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg01216.txt.bz2 On Thu, 2011-03-31 at 13:23 +0200, Ulrich Weigand wrote: > Thiago Jung Bauermann wrote: > > > 2011-03-28 Thiago Jung Bauermann > > > > * breakpoint.c (breakpoint_re_set_one): Factor out breakpoint-resetting > > code from here ... > > (re_set_breakpoint): ... to here ... > > (addr_string_to_sals): ... and here. > > > +static struct symtabs_and_lines > +addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found) > +{ > + char *s; > + int marker_spec, not_found; > + struct symtabs_and_lines sals; > + struct gdb_exception e; > > This caused a compiler warning for me, aborting the build: > > /home/uweigand/fsf/gdb-head/gdb/breakpoint.c: In function 'addr_string_to_sals': > /home/uweigand/fsf/gdb-head/gdb/breakpoint.c:10587: warning: 'sals.nelts' may be used uninitialized in this function > /home/uweigand/fsf/gdb-head/gdb/breakpoint.c:10587: warning: 'sals.sals' may be used uninitialized in this function > > At the place where you removed the variable definition, we used to have > a dummy initializer, presumably to avoid just such warnings: > > @@ -10493,14 +10603,6 @@ breakpoint_re_set_one (void *bint) > { > /* Get past catch_errs. */ > struct breakpoint *b = (struct breakpoint *) bint; > - int not_found = 0; > - int *not_found_ptr = ¬_found; > - struct symtabs_and_lines sals = {0}; > > The patch below adds the initializer back, fixing the build for me. > > Tested on amd64-linux, committed to mainline. I just compiled with -O3 and I was able to reproduce the problem here. I've been compiling without any optimization. Sorry for the trouble, and thanks for fixing it. BTW, I'm also seeing a warning in macroexp.c when compiling with -O3. I'll commit a patch to fix that shortly if someone doesn't beat me to it. -- []'s Thiago Jung Bauermann IBM Linux Technology Center