title: C calling conventions and passed arguments
body: <p>When making a function call in Linux (or OS X for that matter), can the callee modify the values of the arguments on the stack?  I was under the assumption that since the caller is the one that cleans them up, that they should contain the same values after the function call.  However I found that GCC with -O2 was modifying parameters that were passed to it on the stack.  I have also looked for documentation including the System V i386 calling conventions, but was unable to find a <em>definitive</em> answer to this.</p>
  
  <p>Here is some sample code I was debugging.</p>
  
  <pre><code>pushl %eax       # %eax = 0x28
  call _print_any
  popl %eax
                   # %eax is now 0x0a
  </code></pre>
  
  <p>I would assume that GCC modifying that parameter on the stack is fine, but I want to know where it is specified that it <em>can</em> do so.</p>