https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103194
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2021-11-11 Ever confirmed|0 |1 --- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> --- The narrowing cast isn't handled: [hjl@gnu-cfl-2 pr102566]$ cat x3.c #include <stdatomic.h> int foo (_Atomic long long int *v) { return atomic_fetch_or_explicit (v, 1, memory_order_relaxed) & 1; } [hjl@gnu-cfl-2 pr102566]$ make x3.s /export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/ -O2 -S x3.c [hjl@gnu-cfl-2 pr102566]$ cat x3.s .file "x3.c" .text .p2align 4 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc movq (%rdi), %rax .L2: movq %rax, %rcx movq %rax, %rdx orq $1, %rcx lock cmpxchgq %rcx, (%rdi) jne .L2 movl %edx, %eax andl $1, %eax ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 12.0.0 20211111 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-cfl-2 pr102566]$