[LLVMbugs] [Bug 12785] New: [Windows] thiscall is not handled correctly

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu May 10 05:46:02 PDT 2012


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

             Bug #: 12785
           Summary: [Windows] thiscall is not handled correctly
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Repro as of r155981:
=========================
#include <stdio.h>

class C {
 public:
  void foo() { printf("%d\n", a); }

 private:
  int a;
};

int main() {
  C c;
  c.foo();
}
=========================

$ clang++ -Xclang -cxx-abi -Xclang microsoft thiscall.cpp -S
$ vim thiscall.s
...
...
_main:                                  # @main
# BB#0:                                 # %entry
        pushl   %ebp
        movl    %esp, %ebp
        andl    $-8, %esp
        subl    $16, %esp
        leal    8(%esp), %eax
        movl    %eax, (%esp)
        calll   "?foo at C@@QAEXXZ"
...

As you can see, 'this' is pushed on top of the stack.
Should be: put into ECX.

-- 
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