[llvm-bugs] [Bug 35441] New: AsmParser::parseMSInlineAsm() incorrectly assumes whitespace when rewriting expressions

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 27 12:44:33 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35441

            Bug ID: 35441
           Summary: AsmParser::parseMSInlineAsm() incorrectly assumes
                    whitespace when rewriting expressions
           Product: new-bugs
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: vadim at penzin.net
                CC: llvm-bugs at lists.llvm.org

Created attachment 19480
  --> https://bugs.llvm.org/attachment.cgi?id=19480&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171127/ae8e30ba/attachment.html>


More information about the llvm-bugs mailing list