From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 74D2D395C40C; Mon, 14 Jun 2021 18:59:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74D2D395C40C From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101062] [10/11/12 Regression] wrong code with "-O2 -fno-toplevel-reorder -frename-registers" Date: Mon, 14 Jun 2021 18:59:12 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 10.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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: Mon, 14 Jun 2021 18:59:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101062 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ebotcazou at gcc dot gnu.o= rg --- Comment #4 from Jakub Jelinek --- Ah, and there is also a problem that for bitfields in unions we don't create DECL_BIT_FIELD_REPRESENTATIVE in finish_bitfield_layout and so then get_bit_range returns { 0, 0 } as bitstart, bitend and so the access isn't really restricted. So, wonder, shall we for bitfields in UNION_TYPE in get_bit_range return the range of the union? Or is it ok for d[4].b RMW to update also d[5].b next = to it, just not anything beyond end of the variable (so essentially set bitregion_start/bitregion_end to the start and end of d variable), something else? At least for multithreaded apps, even the modification of another element of the same array seems bad to me. Does Ada allow bitfields in unions and if yes, what does it want for those? Changing the testcase with sed -i -e s/union/struct/g fixes the bug...=