<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 --- - Empty inline assembly block results in erroneous stack pointer and segmentation fault"
   href="http://llvm.org/bugs/show_bug.cgi?id=20726">20726</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Empty inline assembly block results in erroneous stack pointer and segmentation fault
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>johan.overbye@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Error occurs on iOS, in C++ code built with Xcode 5.1.1, using -mno-thumb.

The following boiled-down function seems to reproduce the issue both with and
without optimisation enabled. I've inspected the disassembly without
optimisation and there does seem to be an error in the generated code which
causes SP to receive an erroneous value.

inline void test()
{
    register int v0 asm ("r0") = 0;
    register int v1 asm ("r1") = 0;
    register int v2 asm ("r2") = 0;
    register int v3 asm ("r3") = 0;
    register int v4 asm ("r4") = 0;
    register int v5 asm ("r5") = 0;
    register int v6 asm ("r6") = 0;
    register int v7 asm ("r7") = 0;
    int v8 = 0;
    int v9 = 0;

    asm volatile (
    ""
    :
    [v0] "+r" (v0),
    [v1] "+r" (v1),
    [v2] "+r" (v2),
    [v3] "+r" (v3),
    [v4] "+r" (v4),
    [v5] "+r" (v5),
    [v6] "+r" (v6),
    [v7] "+r" (v7),
    [v8] "+r" (v8),
    [v9] "+r" (v9)
    ::);
}</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>