http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56560
Bug #: 56560 Summary: [4.7 regression] vzeroupper clobbers argument with AVX Classification: Unclassified Product: gcc Version: 4.7.3 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: ebotca...@gcc.gnu.org Target: x86_64-*-* The vzeroupper optimization pass can go awry on the 4.7 branch and clobbers arguments passed to functions: eric@polaris:~> cat t.c /* { dg-do compile } */ /* { dg-options "-O2 -mavx" } */ extern void abort (void); typedef double vec_t __attribute__((vector_size(32))); struct S { int i1; int i2; int i3; }; extern int bar (vec_t, int, int, int, int, int, struct S); void foo (vec_t v, struct S s) { int i = bar (v, 1, 2, 3, 4, 5, s); if (i == 0) abort (); } /* { dg-final { scan-assembler-not "vzeroupper" } } */ eric@polaris:~> ~/install/gcc-4_7-branch/bin/gcc -S -O2 -mavx t.c eric@polaris:~> cat t.s .file "t.c" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movl $5, %r8d movl $4, %ecx movl $3, %edx movq %rsp, %rbp .cfi_def_cfa_register 6 andq $-32, %rsp subq $64, %rsp movq %rdi, (%rsp) movl %esi, 8(%rsp) movl $1, %edi movl $2, %esi vzeroupper call bar testl %eax, %eax je .L5 leave .cfi_remember_state .cfi_def_cfa 7, 8 ret .L5: .cfi_restore_state .p2align 4,,9 call abort .cfi_endproc