https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103372
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2021-11-30 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So clang in this case is wrong in that there is no reason to do figure out failure since succ is memory_order_relaxed. In this case, with a non-constant in failure, GCC should just choise the same as success. Likewise the opposite way around. Except for release/memory_order_acq_rel which should get special cases. ยง7.17.7.4 "The failure argument shall not be memory_order_release nor memory_order_acq_rel. The failure argument shall be no stronger than the success argument."