https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71716
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 38811 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38811&action=edit gcc7-pr71716.patch Untested fix. Beyond this, it would be nice if at least the C FE _Atomic cas loop lowering is improved (for the lock-free case only?), so that the old var does not have floating point type, but instead corresponding integral type. The thing is, otherwise if one is unlucky enough, the VIEW_CONVERT_EXPR in the IL from __int128 to long double can be expanded through XFmode store to uninitialized memory slot, which leaves lots of bits uninitialized. If those uninitialized bits don't match the one in the *addr, then the CAS will fail the first time.