From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 122179 invoked by alias); 20 Jul 2015 21:57:35 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 122139 invoked by uid 48); 20 Jul 2015 21:57:31 -0000 From: "jfb at chromium dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/66881] Possibly inefficient std::atomic codegen on x86 for simple arithmetic Date: Mon, 20 Jul 2015 21:57:00 -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: 4.9.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jfb at chromium dot org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE 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: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg01764.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66881 JF Bastien changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jfb at chromium dot org --- Comment #6 from JF Bastien --- I don't think this is a duplicate of PR 50677: this issue uses two *separate* atomic operations, which inherently aren't atomic, whereas PR 50677 uses a single volatile operations which some (misguided) developers expect to be atomic. The compiler may decide to be nice to developers who have misguided expectations from using volatile, but this example clearly uses separate load/store operations. I believe Thomas is correct: the code for f() should codegen the same code as g().