From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6B4E83858CDB; Thu, 20 Jul 2023 09:57:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B4E83858CDB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689847027; bh=eLnWFnK2R1+Z/M2f7zJk0E2UogYyh8GhsKng/5Z0pwc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uSuY3haThx63n7t6UlJmxJYGP6jmmGhOmJIqIGcvms1OaeaxX6ll10myH7eshPQ+y 8PPPRfVJvmhZoD4c3yNHA+dBRboUohpw2Jtm7LBapqPrjpHNLiGK00/eGIXRmUCjfo auBuE5PK7mWTZCTGzvh8BEIGmrVRrCoZd3DZPaaQ= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110743] Unexpected -ftrivial-auto-var-init=pattern behavior with partial bitfields Date: Thu, 20 Jul 2023 09:57:07 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: everconfirmed cc bug_status cf_reconfirmed_on blocked 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=3D110743 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 CC| |jakub at gcc dot gnu.org, | |rguenth at gcc dot gnu.org Status|UNCONFIRMED |NEW Last reconfirmed| |2023-07-20 Blocks| |24639 --- Comment #1 from Richard Biener --- We interestingly see : op =3D .DEFERRED_INIT (24, 1, &"op"[0]); _1 =3D MEM [(struct spi_mem_op *)&op]; _2 =3D _1 & 1; MEM [(struct spi_mem_op *)&op] =3D _2; _3 =3D MEM [(struct spi_mem_op *)&op + 8B]; _4 =3D _3 & 1; MEM [(struct spi_mem_op *)&op + 8B] =3D _4; spi_nor_read_any_reg (&op); op =3D{v} {CLOBBER(eol)}; return; which is done by __builtin_clear_padding which we insert during gimplificat= ion: void s25fs256t_post_bfpt_fixup_nor () { struct spi_mem_op op; try { op =3D .DEFERRED_INIT (24, 1, &"op"[0]); __builtin_clear_padding (&op, 1B); spi_nor_read_any_reg (&op); } finally { op =3D {CLOBBER(eol)}; } } I'm not sure why we do it this way. I wonder why we don't diagnose this at -O0. Note RTL expansion of .DEFERRED_INIT _does_ write to the bitfield padding so maybe we can avoid doing that in __builtin_clear_padding (with an extra op?). Confirmed. A workaround is to explicitely name the padding thus add int padding : 31, = etc. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues=