[LLVMbugs] [Bug 12574] New: [windows] Class constructor and destructor lead to infinite recursion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 17 08:14:03 PDT 2012


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

             Bug #: 12574
           Summary: [windows] Class constructor and destructor lead to
                    infinite recursion
           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:
---------------------------
#include <stdio.h>

class A {
 public:
  A() {}
  ~A() {}
};

int main() {
  printf("before ctor\n");
  {
    volatile A a;
    printf("before dtor\n");
  }
  printf("after  dtor\n");
}
---------------------------

$ clang++.exe -g -Xclang -cxx-abi -Xclang microsoft destructor_crash.cpp -c -S
$ vim destructor_crash.s
...
"??0A@@QAE at XZ":                         # @"\01??0A@@QAE at XZ"
"Lllvm$workaround$fake$stub$??0A@@QAE at XZ":
Lfunc_begin1:
  .loc  1 5 0                   # destructor_crash.cpp:5:0
# BB#0:                                 # %entry
  pushl %ebp
  movl  %esp, %ebp
  subl  $8, %esp
  movl  8(%ebp), %eax
  movl  %eax, -4(%ebp)
  movl  -4(%ebp), %eax
  .loc  1 5 8 prologue_end      # destructor_crash.cpp:5:8
Ltmp9:
  movl  %eax, (%esp)
  calll "??0A@@QAE at XZ"          ###### Constructor calling itself!
  addl  $8, %esp
  popl  %ebp
  ret
Ltmp10:
Lfunc_end1:

"??1A@@QAE at XZ":                         # @"\01??1A@@QAE at XZ"
"Lllvm$workaround$fake$stub$??1A@@QAE at XZ":
Lfunc_begin2:
  .loc  1 6 0                   # destructor_crash.cpp:6:0
# BB#0:                                 # %entry
  pushl %ebp
  movl  %esp, %ebp
  subl  $8, %esp
  movl  8(%ebp), %eax
  movl  %eax, -4(%ebp)
  movl  -4(%ebp), %eax
  .loc  1 6 8 prologue_end      # destructor_crash.cpp:6:8
Ltmp13:
  movl  %eax, (%esp)
  calll "??1A@@QAE at XZ"          ###### Destructor calling itself!
  .loc  1 6 9                   # destructor_crash.cpp:6:9
  addl  $8, %esp
  popl  %ebp
  ret
Ltmp14:
Lfunc_end2:

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