https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91918
--- Comment #5 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- In general this sort of thing is undefined behavior under 7.1.4. It's valid to give an error in this case (as the types are wrong), but it's liable to be hard to do so in all cases for generic functions implemented using macros. In this case an error could probably be achieved reliably by implementing stricter checks for the arguments to the __atomic_compare_exchange built-in function.