From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 328ED3856176 for ; Sun, 23 Oct 2022 16:28:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 328ED3856176 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 BD21D34116D; Sun, 23 Oct 2022 16:28:47 +0000 (UTC) Date: Sun, 23 Oct 2022 20:59:21 +0545 From: Mike Frysinger To: Tsukasa OI Cc: Andrew Burgess , Nick Clifton , gdb-patches@sourceware.org Subject: Re: [PATCH 33/40] sim/ppc: Initialize reg and control_nr Message-ID: Mail-Followup-To: Tsukasa OI , Andrew Burgess , Nick Clifton , gdb-patches@sourceware.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="q54Nnc8IKl/3m0uR" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --q54Nnc8IKl/3m0uR Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 20 Oct 2022 09:32, Tsukasa OI wrote: > GCC generates a warning if a variable may be used uninitialized on some > cases ("-Wmaybe-uninitialized"). Despite that GCC will not cause a build > failure even when "--enable-werror" is specified, it would be nice to get > rid of it. >=20 > This commit initializes variables "reg" and "control_nr" when declared. > --- > sim/ppc/hw_ide.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > --- a/sim/ppc/hw_ide.c > +++ b/sim/ppc/hw_ide.c > @@ -729,8 +729,8 @@ hw_ide_io_read_buffer(device *me, > unsigned_word cia) > { > hw_ide_device *ide =3D (hw_ide_device *)device_data(me); > - int control_nr; > - int reg; > + int control_nr =3D 0; > + int reg =3D 0; > ide_controller *controller; > =20 > /* find the interface */ > @@ -783,8 +783,8 @@ hw_ide_io_write_buffer(device *me, > unsigned_word cia) > { > hw_ide_device *ide =3D (hw_ide_device *)device_data(me); > - int control_nr; > - int reg; > + int control_nr =3D 0; > + int reg =3D 0; > ide_controller *controller; > =20 > /* find the interface */ afaict, this is a false positive. these two vars are initialized by the decode_address call, and if it's unable to, it calls device_error which is supposed to be marked NORETURN. what if we change decode_address to initialize both output variables and leave a comment there explaining why. -mike --q54Nnc8IKl/3m0uR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmNVWk0ACgkQQWM7n+g3 9YFYhhAAkOoibmOi7J3hsmrdxtENYt/auXOstHyOAdmKv2ctdWWtCIrAF4qEs42D rAgGcdnqPBzGbQdemS002JztJgZguBSWZbsRy8jusVnLmLindCc3xNkz6QAsx1D4 p86d1OZHz1Pk32P3GanZgWDRGUJr1yufnH4seUpwm4Z7vPtcyFUrRby154fkqNZW k3Tx8GNLGzxtyCgq22N8R692RciY5aYsm/oJL0VxkUvY4PYilGK7P8EjIU+Oq/Rz KeqPSTGuQzi4BlMpEJ136OOExeR2yO2mbKFMJpkIpL+Fa4+S+lEAN787b9BUeks1 vD6LBwhoeIjLHPlrtfHVRs9Vxt8BSf2p3SlEjQUHjNIzdGMA1VNj57puz0iQ+FpY zbCy9GnJuhqsUt+977trfNSFkcHn6XZN4OUbVssQxHKQ7ucOjk/l9WtRbcb7NWbJ RIr6qO22A1oGBvzn/TcQT430Ayp7X0TegeBYskqgBiiW5u9FjojQrjZHlPXHdSfA p8UWga5d/4Fp8ssdk30fnK7eHMJLuCai8qq9+hiF1sLdQbUVP7ZWecCUJdm757/N Ic0mGpPMRNS4uKuNMS27xsK58X9T1+syy0o6tmlAc48nJXB9zKaz57pvsAD1iL1U g8bbvlM1q2qSjHnLDJ7PZ2+G0lJ6eRWEnlc4YPJRrNRJRVEjcSc= =4yU3 -----END PGP SIGNATURE----- --q54Nnc8IKl/3m0uR--