From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 87BF5385840D; Wed, 29 May 2024 14:45:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 87BF5385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716993924; bh=yG/U29igP1u/qTrF8y1wye1lYQUFyILL4PjnIObW0SM=; h=From:To:Subject:Date:From; b=aZPY66jz0axcFexWilPWBe4cskqU+JlEOsLC7KWOQ5WtNGOykG2LPYqrdlOFtqQR0 pqruqYOEeU9UiPX8D2fcYFBzOja+avjV6u7x+SHXNFw6wdxAaol8lT6dnLyGrupagV S2UJvviauetdY2FaCIAo21Wlo61j42Z0eZDgOu+g= From: "raffeck at cs dot fau.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/115278] New: -ftree-vectorize optimizes away volatile write on x86_64 Date: Wed, 29 May 2024 14:45:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: raffeck at cs dot fau.de X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: 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=3D115278 Bug ID: 115278 Summary: -ftree-vectorize optimizes away volatile write on x86_64 Product: gcc Version: 14.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: raffeck at cs dot fau.de Target Milestone: --- Created attachment 58308 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D58308&action=3Dedit minimal example to reproduce bug The code in the attached minimal example contains two volatile writes to the same address. With `gcc -O2 -fno-tree-loop-vectorize`, two writes are present in the generated object code. With just `gcc -O2` however, only one write is preserved, the other seems to be optimized away. As these are volatile accesses, this should be an illegal optimization. The behavior does not occur with commit 498ad738690, but occurs with 25413fdb2ac, so probably 25413fdb2ac introduced this bug. The behavior still persists in the current master (commit f46eaad445e).=