https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100264
--- Comment #1 from Christoph M. <christophm30 at gmail dot com> --- A patch can be found here: https://gcc.gnu.org/pipermail/gcc-patches/2021-April/568680.html It does not show any regressions (target riscv*). The patch does not include a new test case to demonstrate it actually works, because I don't know a generic way to test it. At the moment I am testing indirectly using __atomic_compare_and_exchange () on riscv64 to emit the required store-conditional. However, the code required for that is not merged yet. Ideas on how to test this in a more generic way are very much appreciated.