From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9ACF8385703A; Wed, 25 Oct 2023 16:10:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9ACF8385703A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1698250221; bh=pftnIjk5JqXofVKtHW+2WX1X+lrYIxmDY7TtyRagZCI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=T1lmgtBOcEhKn4yNYdJt7rp6OKa0s+6l5B9YaKhjC3OcSIPeEVHrQLBnr7/sETg1n OsFsYTll5bYWdBaZ88ndt8j8+SEpHhK07DUxS6j9R0OcfWnl03/HxROY/HLMfRsPsG BfaoglEc/6EPnh1XG+72002mBnoWQAbDhE90tPiE= From: "luke.geeson at cs dot ucl.ac.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111235] [Armv7-a]: Control-dependency between atomic accesses removed by -O1. Date: Wed, 25 Oct 2023 16:10:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: luke.geeson at cs dot ucl.ac.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: wilco 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=3D111235 --- Comment #5 from Luke Geeson --- Thank you for fixing this, Wilco! I will now test this bug using the code emitted by Godbolt.=20 Consider again the same source program. When run through gcc with the same flags we get the ARM assembly test: ``` ARM test { [P0_r0]=3D0;[P1_r0]=3D0;[x]=3D0;[y]=3D0; %P0_P0_r0=3DP0_r0;%P0_x=3Dx;%P0_y=3Dy; %P1_P1_r0=3DP1_r0;%P1_x=3Dx;%P1_y=3Dy } (*****************************************************************) (* the Telechat toolsuite *) (* *) (* Luke Geeson, University College London, UK. *) (* gcc -O1 -march=3Darmv7-a -pthread --std=3Dc11 -marm -fno-section-anchors= *) (* *) (*****************************************************************) P0 | P1 ; LDR R2,[%P0_x] | LDR R2,[%P1_y] ; CMP R2,#1 | DMB ISH ; BEQ L3 | MOV R1,#1 ; L2: STR R2, [%P0_P0_r0]| STR R1, [%P1_x] ; BX LR | STR R2, [%P1_P1_r0] ; L3: MOV R1, #1 | ; STR R1, [%P0_y] | ; B L2 | ; exists (P0_r0=3D1 /\ P1_r0=3D1) ``` Which under the arm model has the outcomes: ``` [P0_r0]=3D0; [P1_r0]=3D0; [P0_r0]=3D1; [P1_r0]=3D0; ``` As you can see the buggy behaviour has gone away, the bug is fixed.=