[LLVMbugs] [Bug 8461] New: clang wrongly ontimizes stdcall functions calling cdecl ones (i386)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 25 13:14:01 PDT 2010


           Summary: clang wrongly ontimizes stdcall functions calling
                    cdecl ones (i386)
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: slyich at gmail.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

#define STDCALL __attribute__((stdcall))

// extern "C" does not matter. Just for nicer named in dsisasm
extern "C" void foo (void);

class I {
    virtual void Startup() STDCALL;

void I::Startup() //STDCALL
Code generated by clang (-m32 -g -O2 -fomit-frame-pointer):
void I::Startup() //STDCALL
   0:   e9 fc ff ff ff          jmp    1 <_ZN1I7StartupEv+0x1>

Code generated by g++:
void I::Startup() //STDCALL
   0:   83 ec 0c                sub    $0xc,%esp
   3:   e8 fc ff ff ff          call   4 <_ZN1I7StartupEv+0x4>
   8:   83 c4 0c                add    $0xc,%esp
   b:   c2 04 00                ret    $0x4

We see proper 'ret $0x4' here.

I'll attach whole tarball with mk.sh script. It causes SIGSEGV for me:

./mk.sh: line 18: 26523 Segmentation fault      ./prog

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