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

            Bug ID: 60926
           Summary: Compiler doesn't properly align stack pointer
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gidici61 at gmail dot com

Assembly code of the sample C code:

int g2(int p1) { return p1; }            
int g1(int p1) { return g2(p1); }
int main()     { return g1(65); }

when compiled [¹] on Debian wheezy using gcc v.4.7.2 shows that register rsp is
not 16 byte aligned before calling g2():

g1:
    pushq    %rbp
    movq    %rsp, %rbp
    subq    $8, %rsp         ; why 8? 
    movl    %edi, -4(%rbp)
    movl    -4(%rbp), %eax
    movl    %eax, %edi
    call    g2
    leave
    ret

[¹] gcc -S filename.c

Reply via email to