[LLVMbugs] [Bug 10870] New: buggy behaviour when exception is thrown from the constructor
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Sep 6 08:15:41 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10870
Summary: buggy behaviour when exception is thrown from the
constructor
Product: clang
Version: 2.9
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: adriano.mitre at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
The attached example demonstrates what seems to be a bug in clang when an
exception is thrown from the constructor. Although the behaviour is different
whether the construction/allocation is static or dynamic, it is wrong in both
cases.
Constrast
$ make CXX=g++ # default
$ /ctorexcept static 1234
instances: 0
$ /ctorexcept dynamic 1234
instances: 0
with
$ make CXX=clang++
$ /ctorexcept static 1234
instances: 10
$ /ctorexcept dynamic 1234
# segmentation fault!
# according to valgrind it was an "Invalid free() / delete / delete[]"
If the destructor is not defined, which may be achieved compiling with
$ make CXX_FLAGS=-DISABLE_DTOR
no segmentation fault ocurrs in the dynamic case, making its behaviour seemly
identical to the static case.
--
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