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: unassignedb...@nondot.org
          Reporter: va...@penzin.net
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to