From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31416 invoked by alias); 9 Apr 2015 11:10:16 -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 31329 invoked by uid 48); 9 Apr 2015 11:10:08 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65697] __atomic memory barriers not strong enough for __sync builtins Date: Thu, 09 Apr 2015 11:10:00 -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: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-04/txt/msg00670.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65697 --- Comment #8 from Jonathan Wakely --- (In reply to Matthew Wahab from comment #7) > I agree that this wouldn't affect valid C11 code (because of data-races) but > my understanding is that __sync builtins don't require a C11 model. The You say that like it's a good thing :-) They don't require a memory model only because there wasn't a cross-platform one that existed at the time. > problem is that the __syncs are being implemented using atomic operations > that do assume a C11 model and its notion of program validity. This looks > like it would lead to differences in behaviour when code, using only the > __sync builtins and knowing nothing of C11, is moved between targets with > different memory models. It seems unsurprising to me that you'll get different behaviour when trying to use a program written with no formal memory model on platforms with different memory models.