title: What (actually) happens, when a function with the warning "control reaches end of non-void function" is called?
body: <p>I know what this message means, I just wondered why it is <strong>not</strong> an error message, but just a warning?</p>
  
  <p>What happens in this case? For example, suppose I have a function</p>
  
  <pre><code>int f()
  {
  }
  </code></pre>
  
  <p>and what happens when I call it?<br>
  Does the compiler adds returning of "non-initialized" <code>int</code> in this case?<br>
  Or the missing return could cause stack corruption?<br>
  Or it's (absolutely) <em>undefined behavior</em> ?</p>
  
  <p><sub>Tested with gcc 4.1.2 and 4.4.3</sub></p>
  
  <hr>
  
  <p><strong>EDIT:</strong> Reading the answers I understand one thing, reading the comments - another..</p>
  
  <p>OK, let's summarize: it's <em>undefined behavior</em>. Then, this means, that it is <em>possible</em> to result in stack corruption, right? (it even means, that my computer may start throwing rotten tomatoes over me through the mic jack, screaming - "what have you done???").</p>
  
  <p>But if so, then why the top answer here says, that stack corruption can't happen and, in the same time, that the behaviour is undefined?</p>
  
  <p>And undefined in respect to? The caller, that tries to use the "not returned value", or just the end of the function is undefined, if it must return value, but it doesn't?</p>
  
  <p>Or it's not undefined behavior, and just the user, who tries to use the value (that is not returned, d'oh!) will "receive" undefined <em>value</em>? In other words - just some garbage value and nothing more can happen?</p>