https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91502
--- Comment #1 from Ruslan Nikolaev <nruslan_devel at yahoo dot com> --- btw, the same problem for #include <stdatomic.h> int func(_Atomic(long) *a) { return (atomic_fetch_sub(a, 1) <= 0); } In the previous case clang/llvm was just like gcc, i.e., unable to optimize; in this case clang/llvm was able to produce better code, but gcc still cannot.