<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Clang accept invalid inline asm"
   href="https://bugs.llvm.org/show_bug.cgi?id=49167">49167</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang accept invalid inline asm
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>11.0
          </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>zhan3299@purdue.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

I got an invalid program:

---
int a;
int main() { asm("" : "=a"(a), "=d"(a) : "d"(.1), "1"(&a)); }
---

I use c-reduce to get the minimal test-case. It is an invalid code. But clang
version 11.1.0 accepts it by accident (my apt-installed 6.0.0 also accepts it).

Note that above code is rejected by GCC (I tested from 6.0 to 10.0) no matter
what optimization level is used. Specifically, GCC blames that ‘asm’ operand
has impossible constraints.

I guess clang should have checked it. Otherwise it may generate code with
unpredictable behaviors, when compiling the bogus code with other complex code.</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>