From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [pushed] Fix warning-avoidance initialization in xcoffread.c
Date: Fri, 10 Jun 2022 14:38:23 -0600 [thread overview]
Message-ID: <20220610203823.1165093-1-tom@tromey.com> (raw)
With the registry rewrite series, on Fedora 34, I started seeing this
error in xcoffread.c:
../../binutils-gdb/gdb/xcoffread.c: In function ‘void read_xcoff_symtab(objfile*, legacy_psymtab*)’:
../../binutils-gdb/gdb/xcoffread.c:948:25: error: ‘main_aux’ is used uninitialized [-Werror=uninitialized]
948 | union internal_auxent fcn_aux_saved = main_aux;
| ^~~~~~~~~~~~~
../../binutils-gdb/gdb/xcoffread.c:933:25: note: ‘main_aux’ declared here
933 | union internal_auxent main_aux;
| ^~~~~~~~
I don't know why this error started suddenly... that seems weird,
because it's not obviously related to the changes I made.
Looking into it, it seems this line was intended to avoid a similar
warning -- but since 'main_aux' is uninitialized at the point where it
is used, this fix was incomplete.
This patch avoids the warning by initializing using "{}". I'm
checking this in.
---
gdb/xcoffread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index e520d7ad40b..9e571d0419c 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -945,7 +945,7 @@ read_xcoff_symtab (struct objfile *objfile, legacy_psymtab *pst)
struct xcoff_symbol fcn_stab_saved = { 0 };
/* fcn_cs_saved is global because process_xcoff_symbol needs it. */
- union internal_auxent fcn_aux_saved = main_aux;
+ union internal_auxent fcn_aux_saved {};
struct context_stack *newobj;
const char *filestring = pst->filename; /* Name of the current file. */
--
2.34.1
reply other threads:[~2022-06-10 20:38 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=20220610203823.1165093-1-tom@tromey.com \
--to=tom@tromey.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).