https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66867
Bug ID: 66867 Summary: Suboptimal code generation for C11 atomic_compare_exchange_strong_explicit() Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: sebastian.hu...@embedded-brains.de Target Milestone: --- At least on ARM and PowerPC for the following test case #include <stdatomic.h> void f(atomic_uint *a) { unsigned int e = 0; atomic_compare_exchange_strong_explicit(a, &e, 1, memory_order_relaxed, memory_order_relaxed); } a superfluous stack frame and store is generated: .file "test-cas.c" .machine ppc .section ".text" .align 2 .globl f .type f, @function f: stwu 1,-24(1) <- Superfluous li 9,0 li 10,1 stw 9,8(1) <- Superfluous .L2: lwarx 9,0,3 cmpwi 0,9,0 bne- 0,.L3 stwcx. 10,0,3 bne- 0,.L2 .L3: addi 1,1,24 <- Superfluous blr .size f, .-f .ident "GCC: (GNU) 6.0.0 20150714 (experimental)"