<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </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 --- - MS Inline Assembly $ syntax not supported"
   href="http://llvm.org/bugs/show_bug.cgi?id=19861">19861</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MS Inline Assembly $ syntax not supported
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>joao@tritao.eu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.



Failure:

<span class="quote">>clang-cl asm.c</span >
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;
  MONO_CONTEXT_GET_CURRENT(ctx);
  return 0;
}</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>