From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id OtMbK9RrVWOuxg8AWB0awg (envelope-from ) for ; Sun, 23 Oct 2022 12:29:08 -0400 Received: by simark.ca (Postfix, from userid 112) id 9F6841E112; Sun, 23 Oct 2022 12:29:08 -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=uxDGlwYR; 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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.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 4B6061E0D5 for ; Sun, 23 Oct 2022 12:29:08 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A3DAE385DC05 for ; Sun, 23 Oct 2022 16:29:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3DAE385DC05 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666542547; bh=1A8LuYl/szHEZbbq/sTs9ntEbjZWaMVgQrvzHKGu9I4=; 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=uxDGlwYRaczsLOVNS4d9ISyRsFuFdrcII6Ac9tfylqS+/UD+4fGhf2FwOC5ds/d3o m5mqrMmvix746hOFEalqYbm5Iguwrk4FFe9273T8vF+/mRcl6IBYBkA83+1E6QKhSz fo0q4nm0Isq6kOn2W0qMfzUe7fKBrZ8jI/tbeHXc= 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 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 To: Tsukasa OI 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-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: Nick Clifton , gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" --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--