This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Remove st(X) from the clobber list in 32-bit x86 atomics
ClosedPublic

Authored by cryptoad on Aug 10 2018, 8:33 AM.

Details

Summary

When compiling with WERROR=ON & a recent clang, having the st(?) registers
in the clobber list produces a fatal error (except st(7) for some reason):

.../sanitizer_common/sanitizer_atomic_clang_x86.h:98:9: error: inline asm clobber list contains reserved registers: ST0, ST1, ST2, ST3, ST4, ST5, ST6 [-Werror,-Winline-asm]
        "movq %1, %%mm0;"  // Use mmx reg for 64-bit atomic moves
        ^
<inline asm>:1:1: note: instantiated into assembly here
        movq 8(%esp), %mm0;movq %mm0, (%esi);emms;
^
.../sanitizer_common/sanitizer_atomic_clang_x86.h:98:9: note: Reserved registers on the clobber list may not be preserved across the asm statement, and clobbering them may lead to undefined behaviour.
        "movq %1, %%mm0;"  // Use mmx reg for 64-bit atomic moves
        ^
<inline asm>:1:1: note: instantiated into assembly here
        movq 8(%esp), %mm0;movq %mm0, (%esi);emms;
^

As far as I can tell, they were in there due to the use of the emms
instruction, but removing the clobber doesn't appear to have a functional
impact. I am unsure if there is a better way to address this.

Diff Detail

Event Timeline

cryptoad created this revision.Aug 10 2018, 8:33 AM
Herald added subscribers: Restricted Project, jfb, delcypher, kubamracek. · View Herald TranscriptAug 10 2018, 8:33 AM
vitalybuka accepted this revision.Aug 10 2018, 8:40 AM
This revision is now accepted and ready to land.Aug 10 2018, 8:40 AM
This revision was automatically updated to reflect the committed changes.