From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1FE123858409; Thu, 16 Feb 2023 20:18:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FE123858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676578697; bh=qz8ZpnmQMYEe/LUjYoZ5pcAjb48060BGorMHEGEwz/I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=RhgBXOJnnaZW4GfpI0HeISiDmDMMui/kPTrXKiegY9UDAax9BfFsMzzbvqCrjRLYP wLplMR2GhMz5oaLjbnZoGpfV0h0jJTeyfD/63aZiCbo3kFEDMqbb8xq5Cf6MZxUPD7 +hcbG8HbCcH5Q75R9ZNO3JARJMG8AakMKkZM+YPw= From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107411] trivial-auto-var-init=zero invalid uninitialized variable warning Date: Thu, 16 Feb 2023 20:18:15 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: qinzhao at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: qinzhao at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107411 --- Comment #9 from qinzhao at gcc dot gnu.org --- it's a bug in tree-ssa-uninit.cc actually. when doing the following: /* Ignore the call to .DEFERRED_INIT that define the original var itself as the following case: temp =3D .DEFERRED_INIT (4, 2, =E2=80=9Calt_reloc"); alt_reloc =3D temp; In order to avoid generating warning for the fake usage at alt_reloc =3D temp. */ we need to compare the var name inside the .DEFERRED_INIT call (the 3nd argument) and the name for the left side variable. if they are the same, we will NOT report the warning.=20 there is one issue when we get the name for the left side variable. when the variable doesn't have a DECL_NAME (it's not a user declared variable, which= is the case for this bug): > _1 =3D .DEFERRED_INIT (4, 2, &"D.2389"[0]); > D.2389 =3D _1; (in the above example, D.2389 is a variable that doesn't have a DECL_NAME.) the current checking just ignores this case, and still report the warning. = this is incorrect. The fix is very simple, when get the var name for the left side variable, we should consider this case and come up with the name the same way as we construct the 3rd argument for the call to .DEFERRED_INIT (please refer to = the routine "gimple_add_init_for_auto_var")=