From: Thiago Jung Bauermann <bauerman@br.ibm.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: Joel Brobecker <brobecker@adacore.com>,
gdb-patches ml <gdb-patches@sourceware.org>
Subject: Re: [commit] Fix uninitialized warning (Re: [RFA] Refactor breakpoint_re_set_one)
Date: Thu, 31 Mar 2011 15:03:00 -0000 [thread overview]
Message-ID: <1301582570.9154.10.camel@hactar> (raw)
In-Reply-To: <201103311123.p2VBNFKn020306@d06av02.portsmouth.uk.ibm.com>
On Thu, 2011-03-31 at 13:23 +0200, Ulrich Weigand wrote:
> Thiago Jung Bauermann wrote:
>
> > 2011-03-28 Thiago Jung Bauermann <bauerman@br.ibm.com>
> >
> > * 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
prev parent reply other threads:[~2011-03-31 14:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 15:18 [RFA] Refactor breakpoint_re_set_one Thiago Jung Bauermann
2011-03-28 20:08 ` Joel Brobecker
2011-03-28 20:24 ` Pedro Alves
2011-03-29 1:40 ` Thiago Jung Bauermann
2011-03-29 1:55 ` Joel Brobecker
2011-03-29 12:36 ` Ulrich Weigand
2011-03-31 14:46 ` Thiago Jung Bauermann
2011-03-31 14:37 ` [commit] Fix uninitialized warning (Re: [RFA] Refactor breakpoint_re_set_one) Ulrich Weigand
2011-03-31 15:03 ` Thiago Jung Bauermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301582570.9154.10.camel@hactar \
--to=bauerman@br.ibm.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox