From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A4980384AB47; Thu, 2 May 2024 23:03:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A4980384AB47 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714691033; bh=7QwTOn5cOlcV+zfboNtG001EVN2QbE9UhOkJgbd4ubo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=crszUS6YywH6Vxi5eHsl6jv9Y1hvrgKavBze3HpMRoqdZIxKegch+qACa2dtt7Bik ssIwPJFXVtX/quUF3oZcQVEvAnMMvFlPlEl5LnLzjhktGsVOt8xmCUduv0/jJVJHni EpVFXDio/4Sq4dBZNiqiOCSD0ax7jvLYgS0Y3WjI= From: "nfxjfg at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/114923] gcc ignores escaping pointer and applies invalid optimization Date: Thu, 02 May 2024 23:03:53 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nfxjfg at googlemail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: 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=3D114923 --- Comment #7 from nfxjfg at googlemail dot com --- > Note also the order of the writes to reg1 and reg2 might happen in a diff= erent order in HW so you need to have a full (HW) write barrier between the= m to make sure the write is done in the correct order. Seriously? That breaks literally all code that uses volatile for register access (which, in our firmwares, is ALL code). This just fuels my belief th= at gcc and C compiler developers in general turned C into a useless, fragile language that can't do anything correctly. Is there a way to prevent reordering of volatile accesses?=