<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Omitting return statement in non-void function causes return instruction to be omitted"
   href="http://llvm.org/bugs/show_bug.cgi?id=17739">17739</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Omitting return statement in non-void function causes return instruction to be omitted
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tobias.haegermarck@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code (must be compiled with clang++ -O1 to trigger)

#include <stdio.h>
int foo() { printf("bar"); }
int main() {
        foo();
        return 0;
}

Causes the terminal to spam with "bar" until the stack fills up and the program
segfaults, due to that no ret instruction after the call to printf is generated

This does generate a warning
Yes, this is sort of a duplicate of <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - *critical* code generation problem when a function declared to return something, but no return is called"
   href="show_bug.cgi?id=16071">http://llvm.org/bugs/show_bug.cgi?id=16071</a>
, but wontfix, really? At least upgrade the warning to an error if its gonna
crash everything in completely nonsensical ways

Also very much worthy of noting that from what I can see on the llvm-dis
output, printf is meant to be tail called (e.g jmp), which doesnt seem to
happen, but I'm not terribly experienced with that</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>