From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id 7C4BE385840A for ; Mon, 24 Oct 2022 17:14:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7C4BE385840A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 2A691340F73; Mon, 24 Oct 2022 17:14:00 +0000 (UTC) Date: Mon, 24 Oct 2022 21:44:34 +0545 From: Mike Frysinger To: Andrew Burgess Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/5] sim/cgen: mask uninitialized variable warning in cgen-run.c Message-ID: Mail-Followup-To: Andrew Burgess , gdb-patches@sourceware.org References: <87o7u18b9i.fsf@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dHsXtFUeXne+fPrO" Content-Disposition: inline In-Reply-To: <87o7u18b9i.fsf@redhat.com> X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --dHsXtFUeXne+fPrO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 24 Oct 2022 16:57, Andrew Burgess wrote: > Mike Frysinger writes: > commit 79f4f1d82d1da482e223079deb453eda7b2d2323 > Author: Andrew Burgess > Date: Mon Oct 24 16:55:07 2022 +0100 >=20 > sim/cgen: initialize variable at creation in engine_run_n > =20 > Zero initialize engine_fns entirely at creation, then override those > fields we intend to use, rather than zero just initializing the unused > fields later on. > =20 > There should be no user visible changes after this commit. >=20 > diff --git a/sim/common/cgen-run.c b/sim/common/cgen-run.c > index a9a493c01b9..1ace067a395 100644 > --- a/sim/common/cgen-run.c > +++ b/sim/common/cgen-run.c > @@ -229,7 +229,7 @@ static void > engine_run_n (SIM_DESC sd, int next_cpu_nr, int nr_cpus, int max_insns, = int fast_p) > { > int i; > - ENGINE_FN *engine_fns[MAX_NR_PROCESSORS]; > + ENGINE_FN *engine_fns[MAX_NR_PROCESSORS] =3D {}; > =20 > SIM_ASSERT (nr_cpus <=3D MAX_NR_PROCESSORS); > SIM_ASSERT (next_cpu_nr >=3D 0 && next_cpu_nr < nr_cpus); > @@ -242,11 +242,6 @@ engine_run_n (SIM_DESC sd, int next_cpu_nr, int nr_c= pus, int max_insns, int fast > prime_cpu (cpu, max_insns); > } > =20 > - /* Ensure the remaining engine_fns slots are initialized, this silence= s a > - compiler warning when engine_fns is used below. */ this comment is useful, so i would retain it otherwise lgtm -mike --dHsXtFUeXne+fPrO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNWtmYACgkQQWM7n+g3 9YHoDQ/+LB9WzRMo0zw/aDHrktSBzXsgZBz7CJ1uzZ3N4mq40mAVeSuba2drbw15 8iSWN6Q73mFKocM7Et7RJk7pSbp4sIbUCOKbeIvD/eWcYXZMj7OoRaY1VGVeuxOQ J2tfUxpk0QCNQNPJ7Qt3kWkue+gYRaNVP9SdJdc8xwQtbY5eeWZez2t6jSpW51aT JZeJOEvzm2igS2Drn5cKw5IsTkrNgonTVHoAfVXhzdU82U1Q0qRI5omtuFUttvfw HmFILZnsM7l+IyLEc7AoRP/Nm8G9XQlCGxR0H9X7rwtsBd/sqNDYJYwDlsZmZVQO Vwp23/Lppum769r9t39pOAk5GjJCmDTo9KhUyYSRbIMkJMQCHQ3tpsb7EyGErDO6 iBnB5r7tvNqiWV4clos7gdm4maDh89MjPANgp0lqaGjIOVePM+Ijaks6CiS7pggB 5d2u0rJ5jLksVKff/Khb5POe0wazESLZeoxh4pxYeQftRNPHrCWlGolhtKvsh2DH ts6nwHEkPY0Q82m5FPPX8ZjkIy13peD5YLV8MP5AUozDr+00LkvGdGVWnOaTsCAz h3gWdEnhcskDomgSl242CIlZ6Khs0U1/v5ANZnR/RJ7FpxpJjZmNuxju+bn9PU5k IOEjNEV8S0q2EfUn04hTS5I96Wk5XZW8zODpKN8+UMfxoZsaGyU= =c6q7 -----END PGP SIGNATURE----- --dHsXtFUeXne+fPrO--