https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119796
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 61110 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61110&action=edit gcc15-pr119796.patch So what about this untested patch? Leaving aside whether we really need to lock more than a single lock, at least for GCC 15 and perhaps backports that doesn't feel like an option. Note, the patch will lock no locks for n == 0 on a cacheline boundary, I guess I could add there a special case for that, but with 0 size nothing should be accessed, so I think no locks are needed.