<html>
    <head>
      <base href="https://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 --- - Emit a warning if inline assembly with a clobber list is used inside a naked function."
   href="https://llvm.org/bugs/show_bug.cgi?id=28641">28641</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Emit a warning if inline assembly with a clobber list is used inside a naked function.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>pierregousseau14@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, paul_robinson@playstation.sony.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Having inline assembly with a clobber list in a function marked naked seems
dangerous as this will alter the stack but only at -O0 in the case below,
higher optimisations level are fine.

eg:
$ clang --version
clang version 3.9.0 @r276109
Target: x86_64-unknown-linux-gnu

  #include <stdlib.h>

  __attribute__((__naked__, __noinline__)) int foo(size_t) 
  {
    __asm__ __volatile__ (
      "ret" : : : "rdi"
    );
  }

$ clang -O0 -S test.cpp

# BB#0:                                 # %entry
        movq    %rdi, -16(%rbp)         # 8-byte Spill <- Stack altered
        #APP
        retq
        #NO_APP</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>