https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65697
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- (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.