[LLVMbugs] [Bug 22028] New: clang msvc compatible mode __asm block codegen error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Dec 24 18:23:14 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=22028

            Bug ID: 22028
           Summary: clang msvc compatible mode __asm block codegen error
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: humeafo at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
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/20141225/4ca1e16b/attachment.html>


More information about the llvm-bugs mailing list