From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 367C83858D33; Thu, 2 May 2024 13:44:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 367C83858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714657476; bh=8Ez48nbjoqWrZRBZRgg+FvhGFyG03vkJVde6mIHiSoU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cBQwz+GXl2uM06m1y+1mZpZ5czIWelUIvGWDLU9ivOePTmy2TcN67oe6ZwtBRwy8t oLY2DtCO10kh/aA3ZViLITBzRSOm+yeDN8GVrZxqTo81sDQq4WhllmjeBxEjqn96TA CvVzJgLh/KabhnS+6qhGFNkthVdlpK9Uk3PNmQhY= From: "nfxjfg at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/114923] gcc ignores escaping pointer and applies invalid optimization Date: Thu, 02 May 2024 13:44:35 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nfxjfg at googlemail dot com 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: 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 #3 from nfxjfg at googlemail dot com --- I'm expecting gcc to realize that the pointer escaped into the unknown, and that it can't assume that the memory won't change. This is just causality, = not any vague made up viralyness. Anyway, a 'asm volatile("":::"memory")' is too radical and increased code s= ize too much in my case (but it's a good suggestion). Making the buffer volatile will inhibit optimizations before or after the DMA.=