<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 --- - clang msvc compatible mode __asm block codegen error"
href="http://llvm.org/bugs/show_bug.cgi?id=22028">22028</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang msvc compatible mode __asm block codegen error
</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>LLVM Codegen
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>humeafo@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>a.cc is as follows:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
__asm {
push 0x60
push 0x88887777
pop eax
pop eax
}
return 0;
}
compile this using msvc built clang/llvm x86 version as follows:
clang -c a.cc -S -o a.S
decompile the a.obj and find main, you will found wrong assembly generated by
the compiler:
.text
.def @feat.00;
.scl 3;
.type 0;
.endef
.globl @feat.00
@feat.00 = 1
.def _main;
.scl 2;
.type 32;
.endef
.globl _main
.align 16, 0x90
_main: # @main
# BB#0:
pushl %ebp
movl %esp, %ebp
subl $12, %esp
movl 12(%ebp), %eax
movl 8(%ebp), %ecx
movl $0, -4(%ebp)
movl %eax, -8(%ebp)
movl %ecx, -12(%ebp)
#APP
pushw $96
pushw $2290644855 # imm = 0x88887777
popl %eax
popl %eax
#NO_APP
xorl %ecx, %ecx
movl %eax, -4(%ebp)
movl %ecx, %eax
addl $12, %esp
popl %ebp
retl
.section .drectve,"yn"
.ascii " /FAILIFMISMATCH:\"_CRT_STDIO_LEGACY_WIDE_SPECIFIERS=0\""
here
pushw $96
pushw $2290644855 # imm = 0x88887777
is obviously not correct, should be pushl I suppose, I didn't debugging this
much, so not sure this is a frontend bug or MC's.</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>