From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id o2kLAO3HVmM1JRAAWB0awg (envelope-from ) for ; Mon, 24 Oct 2022 13:14:21 -0400 Received: by simark.ca (Postfix, from userid 112) id E336F1E112; Mon, 24 Oct 2022 13:14:20 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=SaygMys2; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 8E8F21E0D3 for ; Mon, 24 Oct 2022 13:14:20 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 31AB83856DDE for ; Mon, 24 Oct 2022 17:14:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 31AB83856DDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666631660; bh=faCaicefM4Su6Jgt94vPNWIOmZ7ZuVKfBCubNmRROHE=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=SaygMys2oUIH43deHN0ja6HCx2ePBS4POwzRd2a1CRWmsX4RTUQH7WVYP+OMeS7Or D6g2/7b0a64BOyNQL1BPMTg03sd8thhBF8mF15hXvkHFO/rjYeedRO+py8jZzNsLtK DV2VycwJbyVnYWWrOKCMFtN4bIgTbjfHfk4A7ubM= 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 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 To: Andrew Burgess 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-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mike Frysinger via Gdb-patches Reply-To: Mike Frysinger Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --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--