title: Why does GCC on x86-64 insert a NOP inside of a function?
body: <p>Given the following C function:</p>
  
  <pre><code>void go(char *data) {
      char name[64];
      strcpy(name, data);
  }
  </code></pre>
  
  <p>GCC 5 and 6 on x86-64 compile (plain <code>gcc -c -g -o</code> followed by <code>objdump</code>) this to:</p>
  
  <pre><code>0000000000000000 &lt;go&gt;:
     0:   55                      push   %rbp
     1:   48 89 e5                mov    %rsp,%rbp
     4:   48 83 ec 50             sub    $0x50,%rsp
     8:   48 89 7d b8             mov    %rdi,-0x48(%rbp)
     c:   48 8b 55 b8             mov    -0x48(%rbp),%rdx
    10:   48 8d 45 c0             lea    -0x40(%rbp),%rax
    14:   48 89 d6                mov    %rdx,%rsi
    17:   48 89 c7                mov    %rax,%rdi
    1a:   e8 00 00 00 00          callq  1f &lt;go+0x1f&gt;
    1f:   90                      nop
    20:   c9                      leaveq 
    21:   c3                      retq   
  </code></pre>
  
  <p>Is there any reason for GCC to insert the <code>90</code>/<code>nop</code> at <code>1f</code> or is that just a side-effect that might happen when no optimizations are turned on?</p>
  
  <p><em>Note: This question is different from most others because it asks about <code>nop</code> inside a function body, not an external padding.</em></p>
  
  <p><em>Compiler versions tested: GCC Debian 5.3.1-14 (5.3.1) and Debian 6-20160313-1 (6.0.0)</em></p>