https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85595
Bug ID: 85595 Summary: __atomic_is_lock_free(sizeof(unsigned long long), &v) returns true on i686 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: aivchenk at gmail dot com Target Milestone: --- in gcc __atomic_is_lock_free(sizeof(unsigned long long), &v) returns true (in clang it is left as a call) int main() { unsigned long long v; if (__atomic_is_lock_free(sizeof(unsigned long long), &v)) return 0; else return 1; } > g++ -O2 -m32 -std=gnu++11 -fno-exceptions -fno-rtti main: .LFB0: xorl %eax, %eax ret > clang++ -O2 -m32 -std=gnu++11 -fno-exceptions -fno-rtti main: # @main .Lfunc_begin0: # %bb.0: subl $12, %esp .Ltmp0: subl $8, %esp leal 8(%esp), %eax pushl %eax pushl $8 calll __atomic_is_lock_free addl $16, %esp xorl %ecx, %ecx testl %eax, %eax sete %cl .Ltmp1: movl %ecx, %eax addl $12, %esp retl __atomic_is_lock_free always should return false for misaligned pointers (long long is only 4-byte aligned on i686) More details can be found at the bug filed against llvm https://bugs.llvm.org/show_bug.cgi?id=36860