http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53383

--- Comment #10 from Jan Hubicka <hubicka at ucw dot cz> 2012-05-19 21:47:39 
UTC ---
The problem is va_args doing alignment based on stack pointer, i.e. in:
int
test (int a, ...)
{
  va_list p;

  va_start (p, a);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
    va_arg (p, int);
  if (a) 
    va_arg (p, int);
  return va_arg (p, __int128);
}

test:
.LFB0:
        .cfi_startproc
        leaq    8(%rsp), %rax
        movq    %rdx, -40(%rsp)
        movq    %rsi, -48(%rsp)
        movq    %rcx, -32(%rsp)
        movq    %r8, -24(%rsp)
        movq    %rax, -72(%rsp)
        leaq    -56(%rsp), %rax
        addq    $8, -72(%rsp)
        testl   %edi, %edi
        movq    %r9, -16(%rsp)
        movl    $48, -80(%rsp)
        movq    %rax, -64(%rsp)
        movq    -72(%rsp), %rax
        leaq    32(%rax), %rdx
        movq    %rdx, -72(%rsp)
        je      .L14
        addq    $40, %rax
        movq    %rax, -72(%rsp)
.L14:
        movq    -72(%rsp), %rax
        addq    $15, %rax
        andq    $-16, %rax
        leaq    16(%rax), %rdx
        movq    %rdx, -72(%rsp)
        movq    (%rax), %rax
        ret
        .cfi_endproc
.LFE0:

this will get out of sync with hard coded offsets if rsp hapepns to be
misaligned.

Reply via email to