title: GCC allocates more stack space than needed for locals, even without alignment. What's it using the space for?
body: <p>I have a code like this :</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void overflow_me(char* dizi){
      char buff_array[100];
      strcpy(buff_array,dizi);
      printf(&quot;Hosgeldin %s&quot;,buff_array);
  }
  
  
  int main(int argc, char *argv[]){
      overflow_me(argv[1]);
      return 0;
  }
  </code></pre>
  <p>I compile this by using <code>gcc -g -o overflow overflow.c -m32 -mpreferred-stack-boundary=2</code> this.
  Then I open the overflow file with gdb and disassemble the overflow_me function.</p>
  <pre><code>                      endbr32
   0x00001211 &lt;+4&gt;:     push   %ebp
   0x00001212 &lt;+5&gt;:     mov    %esp,%ebp
   0x00001214 &lt;+7&gt;:     push   %ebx
   0x00001215 &lt;+8&gt;:     sub    $0x6c,%esp
  </code></pre>
  <p>I wonder why the stack allocates 108 bytes. I expected that would be 0x64 instead of 0x6c.</p>
  <p>Whole disassembled function :</p>
  <pre><code> 0x0000120d &lt;+0&gt;:     endbr32
   0x00001211 &lt;+4&gt;:     push   %ebp
   0x00001212 &lt;+5&gt;:     mov    %esp,%ebp
   0x00001214 &lt;+7&gt;:     push   %ebx
   0x00001215 &lt;+8&gt;:     sub    $0x6c,%esp
   0x00001218 &lt;+11&gt;:    call   0x1110 &lt;__x86.get_pc_thunk.bx&gt;
   0x0000121d &lt;+16&gt;:    add    $0x2db3,%ebx
   0x00001223 &lt;+22&gt;:    mov    0x8(%ebp),%eax
   0x00001226 &lt;+25&gt;:    mov    %eax,-0x70(%ebp)
   0x00001229 &lt;+28&gt;:    mov    %gs:0x14,%eax
   0x0000122f &lt;+34&gt;:    mov    %eax,-0x8(%ebp)
   0x00001232 &lt;+37&gt;:    xor    %eax,%eax
   0x00001234 &lt;+39&gt;:    pushl  -0x70(%ebp)
   0x00001237 &lt;+42&gt;:    lea    -0x6c(%ebp),%eax
   0x0000123a &lt;+45&gt;:    push   %eax
   0x0000123b &lt;+46&gt;:    call   0x10b0 &lt;strcpy@plt&gt;
   0x00001240 &lt;+51&gt;:    add    $0x8,%esp
   0x00001243 &lt;+54&gt;:    lea    -0x6c(%ebp),%eax
   0x00001246 &lt;+57&gt;:    push   %eax
   0x00001247 &lt;+58&gt;:    lea    -0x1fc8(%ebx),%eax
   0x0000124d &lt;+64&gt;:    push   %eax
   0x0000124e &lt;+65&gt;:    call   0x1090 &lt;printf@plt&gt;
   0x00001253 &lt;+70&gt;:    add    $0x8,%esp
   0x00001256 &lt;+73&gt;:    nop
   0x00001257 &lt;+74&gt;:    mov    -0x8(%ebp),%eax
   0x0000125a &lt;+77&gt;:    xor    %gs:0x14,%eax
   0x00001261 &lt;+84&gt;:    je     0x1268 &lt;overflow_me+91&gt;
   0x00001263 &lt;+86&gt;:    call   0x1320 &lt;__stack_chk_fail_local&gt;
   0x00001268 &lt;+91&gt;:    mov    -0x4(%ebp),%ebx
   0x0000126b &lt;+94&gt;:    leave
   0x0000126c &lt;+95&gt;:    ret
  </code></pre>