Local vars in gcc assembly

When I compile the function below: gcc -S teste.c

void readInput() {
    int buf;
}

teste.S becomes:

readInput:
     pushl   %ebp
     movl    %esp, %ebp
     subl    $16, %esp
     leave
     ret

My doubt is: why is% esp subtracted from 16 bytes, shouldn't it be 4 bytes for int? Does he have a todo with alignment?

Similar things happen when I compile this:

void readInput() {
    char buf;
}

and the output is the same as above.

+3
source share
3 answers

, , , , , , . , , , , , ( , setjmp/longjmp/alloca ), , , .

( -O1), , ​​ , .

0

.

  • .
  • -g .
  • , node, n . , , n + 1 , . . . , - , .
0

16 , , SSE2. ( 128- = 16 * 8). 64- afaik.

Strictly speaking, for non-SSE using leaf procedures, this requirement may be omitted.

0
source

All Articles