<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 - AsmParser::parseMSInlineAsm() incorrectly assumes whitespace when rewriting expressions"
   href="https://bugs.llvm.org/show_bug.cgi?id=35441">35441</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AsmParser::parseMSInlineAsm() incorrectly assumes whitespace when rewriting expressions
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>vadim@penzin.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19480" name="attach_19480" title="Patch against revision 319067">attachment 19480</a> <a href="attachment.cgi?id=19480&action=edit" title="Patch against revision 319067">[details]</a></span>
Patch against revision 319067

Microsoft C/C++ compiler allows the following syntax:

    __asm { mov[foo],2017 }

(Note the absence of whitespace between the opcode "mov" and the left bracket.)

AsmParser::parseMSInlineAsm() rewrites the above fragment as "movdword ptr
$0,$$2017" while the expected result is "mov dword ptr $0,$$2017" (note the
whitespace between the opcode "mov" and the size specifier "dword ptr").

To reproduce the above, please consider the following C source (foo.c):

#include <stdint.h>

int
foo ( void )
{
        int32_t bar = 0;
        __asm {
                mov[bar],2017
        }
        return bar;
}

Please verify generation of the bitcode of the above as follows:

clang-6.0 -S -fasm-blocks -emit-llvm foo.c -o - | grep dword

Please find attached a patch that amends this issue.</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>