Skip to content

clang built on mingw-w64 generates wrong code #10105

@llvmbot

Description

@llvmbot
Bugzilla Link 9733
Resolution DUPLICATE
Resolved on Apr 15, 2011 12:18
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor

Extended Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:codegenIR generation bugs: mangling, exceptions, etc.duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions