[LLVMbugs] [Bug 19861] New: MS Inline Assembly $ syntax not supported

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 26 17:27:55 PDT 2014


            Bug ID: 19861
           Summary: MS Inline Assembly $ syntax not supported
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: joao at tritao.eu
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

While compiling the Mono runtime via clang-cl I've found an issue while
handling MSVC inline assembly. This works correctly with cl but fails with


>clang-cl asm.c
asm.c(1,25) :  error: unexpected token in argument list
int main() { __asm call $+5; }
asm.c(1,30) :  error: expected '}'
int main() { __asm call $+5; }
asm.c(1,11) :  note: to match this '{'
int main() { __asm call $+5; }
2 errors generated.

Minimal repro:

int main() { __asm call $+5; }

Repro with some context:

typedef int mgreg_t;

typedef struct {
  mgreg_t eax;
  mgreg_t ebx;
  mgreg_t ecx;
  mgreg_t edx;
  mgreg_t ebp;
  mgreg_t esp;
  mgreg_t esi;
  mgreg_t edi;
  mgreg_t eip;
} MonoContext;

#define MONO_CONTEXT_GET_CURRENT(ctx) do { \
    void *_ptr = &(ctx); \
    __asm { \
    __asm mov eax, _ptr \
    __asm mov [eax+0x00], eax \
    __asm mov [eax+0x04], ebx \
    __asm mov [eax+0x08], ecx \
    __asm mov [eax+0x0c], edx \
    __asm mov [eax+0x10], ebp \
    __asm mov [eax+0x14], esp \
    __asm mov [eax+0x18], esi \
    __asm mov [eax+0x1c], edi \
    __asm call $+5 \
    __asm pop dword ptr [eax+0x20] \
    } \
  } while (0)

int main()
  MonoContext ctx;
  return 0;

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/20140527/22a742fe/attachment.html>

More information about the llvm-bugs mailing list