From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 9F8323856DE2; Fri, 10 Jun 2022 20:38:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F8323856DE2 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix warning-avoidance initialization in xcoffread.c X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: cbc30d36acfb3f20f7736c5594d81088ae8e4e13 X-Git-Newrev: 2cbde639ae207987fa169ad5ed70e53c11ecdcba Message-Id: <20220610203839.9F8323856DE2@sourceware.org> Date: Fri, 10 Jun 2022 20:38:39 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Jun 2022 20:38:39 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D2cbde639ae20= 7987fa169ad5ed70e53c11ecdcba commit 2cbde639ae207987fa169ad5ed70e53c11ecdcba Author: Tom Tromey Date: Sun Jun 5 11:12:57 2022 -0600 Fix warning-avoidance initialization in xcoffread.c =20 With the registry rewrite series, on Fedora 34, I started seeing this error in xcoffread.c: =20 ../../binutils-gdb/gdb/xcoffread.c: In function =E2=80=98void read_xcof= f_symtab(objfile*, legacy_psymtab*)=E2=80=99: ../../binutils-gdb/gdb/xcoffread.c:948:25: error: =E2=80=98main_aux=E2= =80=99 is used uninitialized [-Werror=3Duninitialized] 948 | union internal_auxent fcn_aux_saved =3D main_aux; | ^~~~~~~~~~~~~ ../../binutils-gdb/gdb/xcoffread.c:933:25: note: =E2=80=98main_aux=E2= =80=99 declared here 933 | union internal_auxent main_aux; | ^~~~~~~~ =20 I don't know why this error started suddenly... that seems weird, because it's not obviously related to the changes I made. =20 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. =20 This patch avoids the warning by initializing using "{}". I'm checking this in. Diff: --- 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_psym= tab *pst) struct xcoff_symbol fcn_stab_saved =3D { 0 }; =20 /* fcn_cs_saved is global because process_xcoff_symbol needs it. */ - union internal_auxent fcn_aux_saved =3D main_aux; + union internal_auxent fcn_aux_saved {}; struct context_stack *newobj; =20 const char *filestring =3D pst->filename; /* Name of the current file. = */