public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Aaron Merey <amerey@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/linespec.c: Fix -Wmaybe-uninitialized warning
Date: Tue, 10 Jan 2023 01:13:02 +0000 (GMT)	[thread overview]
Message-ID: <20230110011302.30CF63858CDA@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2ff63a29b0b01f949c8365f761e883d29709c44a

commit 2ff63a29b0b01f949c8365f761e883d29709c44a
Author: Aaron Merey <amerey@redhat.com>
Date:   Fri Jan 6 19:06:15 2023 -0500

    gdb/linespec.c: Fix -Wmaybe-uninitialized warning
    
    Although the bool want_start_sal isn't actually used without being assigned
    a value, initialize it to be false in order to prevent the following
    -Wmaybe-uninitialized warning:
    
        linespec.c: In function ‘void minsym_found(linespec_state*, objfile*, minimal_symbol*, std::vector<symtab_and_line>*)’:
        linespec.c:4150:19: warning: ‘want_start_sal’ may be used uninitialized [-Wmaybe-uninitialized]
         4150 |   if (is_function && want_start_sal)

Diff:
---
 gdb/linespec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/linespec.c b/gdb/linespec.c
index e9339c3338c..b8c77541a29 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4129,7 +4129,7 @@ minsym_found (struct linespec_state *self, struct objfile *objfile,
 	      struct minimal_symbol *msymbol,
 	      std::vector<symtab_and_line> *result)
 {
-  bool want_start_sal;
+  bool want_start_sal = false;
 
   CORE_ADDR func_addr;
   bool is_function = msymbol_is_function (objfile, msymbol, &func_addr);

                 reply	other threads:[~2023-01-10  1:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20230110011302.30CF63858CDA@sourceware.org \
    --to=amerey@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).