From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB28E3858C83; Tue, 15 Feb 2022 21:33:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB28E3858C83 From: "qinzhao at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104550] bogus warning from -Wuninitialized + -ftrivial-auto-var-init=pattern Date: Tue, 15 Feb 2022 21:33:20 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: qinzhao at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2022 21:33:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104550 --- Comment #3 from qinzhao at gcc dot gnu.org --- the root cause for this bug is due to the new call to __builtin_clear_paddi= ng=20 added by -ftrivial-auto-var-init=3Dpattern, this is treated as a use of the uninitialized variable during early uninitialized analysis phase, in which phase DCE hasn't been applied yet, as a result, the early uninit phase repo= rted this uninitialized usage.=20 the following is the details: 1. without -ftrivial-auto-var-init, the IR in gimple stage is: void vx_set_monitor_level () {=20 struct vx_audio_level info; try { } finally { info =3D {CLOBBER(eol)}; } } no any usage of the auto var "info", no any warning message for -Wuninitialized; 2. With -ftrivial-auto-var-init, the IR in gimple stage is: void vx_set_monitor_level () {=20 struct vx_audio_level info; try { info =3D .DEFERRED_INIT (4, 1, &"info"[0]); __builtin_clear_padding (&info, 1B); } finally { info =3D {CLOBBER(eol)}; } } then after folding of call to "__builtin_clear_padding", the IR at early uninitialized analysis phase is: void vx_set_monitor_level () { struct vx_audio_level info; int _1; int _2; : info =3D .DEFERRED_INIT (4, 1, &"info"[0]); _1 =3D MEM[(struct vx_audio_level *)&info]; _2 =3D _1 & 1; MEM[(struct vx_audio_level *)&info] =3D _2; info =3D{v} {CLOBBER(eol)}; return; } The bogus warning is issued for the following fake usage: _1 =3D MEM[(struct vx_audio_level *)&info]; which is unavoidable during the early uninitialized stage based on the curr= ent IR info.=