https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117312
--- Comment #17 from Uroš Bizjak <ubizjak at gmail dot com> --- With the patch in PR117359 applied and testcase patched with: --cut here-- --- pr117312.c 2024-10-30 10:50:04.921338850 +0100 +++ pr117312-new.c 2024-10-30 10:49:49.441488965 +0100 @@ -1,3 +1,6 @@ +register unsigned long current_stack_pointer asm ("%rsp"); +#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) + /* Just an opaque data source */ static inline __attribute__((always_inline)) int get_random(void) { @@ -22,7 +25,7 @@ /* Clobbers [-16..-1](%rsp) */ /* "volatile" or a memory clobber doesn't seem to make any difference */ asm("push %2; pushf; pop %0; pop %1" - : "=r" (y), "=r" (z) + : "=r" (y), "=r" (z), ASM_CALL_CONSTRAINT : "r" (x) : "memory"); the resulting asm differs in: --- pr117312.s 2024-10-30 10:50:13.170258856 +0100 +++ pr117312-new.s 2024-10-30 10:50:28.517110031 +0100 @@ -1,4 +1,4 @@ - .file "pr117312.c" + .file "pr117312-new.c" .text .p2align 4 .globl asm_clobbers_redzone @@ -6,115 +6,116 @@ asm_clobbers_redzone: .LFB1: .cfi_startproc - movl %edi, %eax + subq $72, %rsp + .cfi_def_cfa_offset 80 #APP -# 5 "pr117312.c" 1 +# 8 "pr117312-new.c" 1 rdrand %edx # 0 "" 2 #NO_APP - movl %edx, -72(%rsp) + movl %edx, (%rsp) #APP -# 5 "pr117312.c" 1 - rdrand %ecx +# 8 "pr117312-new.c" 1 + rdrand %eax # 0 "" 2 #NO_APP - movl %ecx, -68(%rsp) + movl %eax, 4(%rsp) #APP -# 5 "pr117312.c" 1 - rdrand %esi +# 8 "pr117312-new.c" 1 + rdrand %ecx # 0 "" 2 #NO_APP - movl %esi, -64(%rsp) + movl %ecx, 8(%rsp) ... No redzone was used with the patched testcase.