From: Aaron Merey <amerey@redhat.com>
To: gdb-patches@sourceware.org
Cc: Aaron Merey <amerey@redhat.com>
Subject: [PATCH] gdb/linespec.c: Fix -Wmaybe-uninitialized warning
Date: Fri, 6 Jan 2023 19:49:41 -0500 [thread overview]
Message-ID: <20230107004941.589074-1-amerey@redhat.com> (raw)
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)
---
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);
--
2.39.0
next reply other threads:[~2023-01-07 0:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 0:49 Aaron Merey [this message]
2023-01-09 17:10 ` Tom Tromey
2023-01-10 1:16 ` Aaron Merey
2023-01-10 2:53 ` Simon Marchi
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=20230107004941.589074-1-amerey@redhat.com \
--to=amerey@redhat.com \
--cc=gdb-patches@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).