From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2AF94385780E; Thu, 17 Feb 2022 16:47:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2AF94385780E From: "qing.zhao at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104550] bogus warning from -Wuninitialized + -ftrivial-auto-var-init=pattern Date: Thu, 17 Feb 2022 16:47:13 +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: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: qing.zhao at oracle dot com 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: Thu, 17 Feb 2022 16:47:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104550 --- Comment #14 from Qing Zhao --- > On Feb 17, 2022, at 1:54 AM, rguenther at suse dot de wrote: >>=20 >> If padding clearing is exposed too late till RTL expansion, some tree >> optimization will not be able to be applied on the expanded stores?=20 >=20 > Doesn't the same argument apply to .DEFERRED_INIT itself? Dependent > on the .DEFERRED_INIT expansion strathegy the padding clearing might > be unneccessary (for example when using memset())? Yes, because we use memset to initialize auto-var when it=E2=80=99s in memo= ry, we do not insert a call to __builtin_clear_padding to zero initialization. We only insert __builtin_clear_padding to pattern Initialization to set the padding to zeroes. That=E2=80=99s why this bug on= ly exposed with pattern init. >=20 >> the approach to mark the load "MEM" as not needing a warning might be be= tter? >=20 > It's probably a good thing anyway, the 'R' in the RMW cycle isn't really > a use. If it=E2=80=99s not a real use, should we exclude this case from emitting t= he uninitialized warning directly?=