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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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@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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to