https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103069
--- Comment #18 from Thiago Macieira <thiago at kde dot org> --- (In reply to Jakub Jelinek from comment #17) > _Pragma("GCC target \"relax-cmpxchg-loop\"") > should do that (ditto target("relax-cmpxchg-loop") attribute). The attribute is applied to a function. I'm hoping to do it for s block of code: _Pragma("GCC push_options") _Pragma("GCC target \"relax-cmpxchg-loop\"") __atomic_compare_exchange_weak(....); _Pragma("GCC pop_options")