[LLVMbugs] [Bug 9733] New: clang built on mingw-w64 generates wrong code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 15 08:25:49 PDT 2011


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

           Summary: clang built on mingw-w64 generates wrong code
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: coolypf at qq.com
                CC: llvmbugs at cs.uiuc.edu


clang (latest svn trunk)
built with
x86_64-w64-mingw32-gcc version 4.5.3 20110414
configured by 
CC='gcc -m32' CXX='g++ -m32' ../llvm-svn/configure --enable-optimized
--disable-assertions --disable-docs --enable-shared

when compiling the following code

#include <stdio.h>
void stuff()
{
    printf("Hello%s\n", " ");
}

clang -S -m32/-m64 generates the right assembly code, but
clang -S -O2 -m32/-m64 generates wrong code like this:

    .def     _vsnprintf;
    .scl    2;
    .type    32;
    .endef
    .text
    .globl    _vsnprintf
    .align    16, 0x90
_vsnprintf:
    jmpl    *__imp___vsnprintf  # TAILCALL

    .def     _vsnwprintf;
    .scl    2;
    .type    32;
    .endef
    .globl    _vsnwprintf
    .align    16, 0x90
_vsnwprintf:
    jmpl    *__imp___vsnwprintf  # TAILCALL

    .def     _stuff;
    .scl    2;
    .type    32;
    .endef
    .globl    _stuff
    .align    16, 0x90
_stuff:
    pushl    %ebp
    movl    %esp, %ebp
    subl    $8, %esp
    movl    $L_.str1, 4(%esp)
    movl    $L_.str, (%esp)
    calll    _printf
    addl    $8, %esp
    popl    %ebp
    ret

    .data
L_.str:
    .asciz     "Hello%s\n"

L_.str1:
    .asciz     " "


symbols like _vsnprintf & _vsnwprintf should NOT be exported, they are in fact
inlined functions
clang 2.9 release also has this problem.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list