* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
@ 2008-01-28 8:24 ` andry at inbox dot ru
2008-05-15 14:11 ` andry at inbox dot ru
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: andry at inbox dot ru @ 2008-01-28 8:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from andry at inbox dot ru 2008-01-28 02:46 -------
In gcc 4.3 (trunk, 2008.01.27), bug still doesn't fixed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
2008-01-28 8:24 ` [Bug c++/34158] " andry at inbox dot ru
@ 2008-05-15 14:11 ` andry at inbox dot ru
2008-05-23 13:42 ` steve_cheng at scotiacapital dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: andry at inbox dot ru @ 2008-05-15 14:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from andry at inbox dot ru 2008-05-15 14:10 -------
Version 4.3.0 (Release), bug still doesn't fixed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
2008-01-28 8:24 ` [Bug c++/34158] " andry at inbox dot ru
2008-05-15 14:11 ` andry at inbox dot ru
@ 2008-05-23 13:42 ` steve_cheng at scotiacapital dot com
2008-05-23 13:44 ` steve_cheng at scotiacapital dot com
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: steve_cheng at scotiacapital dot com @ 2008-05-23 13:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from steve_cheng at scotiacapital dot com 2008-05-23 13:41 -------
I have hit the same bug as the original reporter.
Attached is a simplified test case. Run with:
$ g++ -v -save-temps -o testPlacementDelete testPlacementDelete.C
$ ./testPlacementDelete
placement new called
exception caught
Expected output should be instead:
placement new called
placement delete called
exception caught
Note that the placement delete is called if the extra argument to placement new
and delete is a non-templated type. It fails when the extra argument is a
templated type.
I am running on:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.1.3 --program-suffix=-4.1
--enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug
--enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
/usr/lib/gcc/i486-linux-gnu/4.1.3/cc1plus -E -quiet -v -D_GNU_SOURCE
testPlacementDelete.C -mtune=generic -fpch-preprocess -o testPlacementDelete.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/4.1.3
/usr/include/c++/4.1.3/i486-linux-gnu
/usr/include/c++/4.1.3/backward
/usr/local/include
/usr/lib/gcc/i486-linux-gnu/4.1.3/include
/usr/include
End of search list.
/usr/lib/gcc/i486-linux-gnu/4.1.3/cc1plus -fpreprocessed
testPlacementDelete.ii -quiet -dumpbase testPlacementDelete.C -mtune=generic
-auxbase testPlacementDelete -version -fstack-protector -fstack-protector -o
testPlacementDelete.s
GNU C++ version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
(i486-linux-gnu)
compiled by GNU C version 4.1.3 20070929 (prerelease) (Ubuntu
4.1.2-16ubuntu2).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129322
Compiler executable checksum: 3cc47be363985179cfafdceddd0e8f5d
as --traditional-format -V -Qy -o testPlacementDelete.o testPlacementDelete.s
GNU assembler version 2.18 (i486-linux-gnu) using BFD version (GNU Binutils for
Ubuntu) 2.18
/usr/lib/gcc/i486-linux-gnu/4.1.3/collect2 --eh-frame-hdr -m elf_i386
--hash-style=both -dynamic-linker /lib/ld-linux.so.2 -o testPlacementDelete
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crt1.o
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crti.o
/usr/lib/gcc/i486-linux-gnu/4.1.3/crtbegin.o
-L/usr/lib/gcc/i486-linux-gnu/4.1.3 -L/usr/lib/gcc/i486-linux-gnu/4.1.3
-L/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib -L/lib/../lib
-L/usr/lib/../lib testPlacementDelete.o -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s
-lgcc /usr/lib/gcc/i486-linux-gnu/4.1.3/crtend.o
/usr/lib/gcc/i486-linux-gnu/4.1.3/../../../../lib/crtn.o
--
steve_cheng at scotiacapital dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |steve_cheng at scotiacapital
| |dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (2 preceding siblings ...)
2008-05-23 13:42 ` steve_cheng at scotiacapital dot com
@ 2008-05-23 13:44 ` steve_cheng at scotiacapital dot com
2008-05-23 13:45 ` steve_cheng at scotiacapital dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: steve_cheng at scotiacapital dot com @ 2008-05-23 13:44 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from steve_cheng at scotiacapital dot com 2008-05-23 13:43 -------
Created an attachment (id=15676)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15676&action=view)
C++ test case
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (3 preceding siblings ...)
2008-05-23 13:44 ` steve_cheng at scotiacapital dot com
@ 2008-05-23 13:45 ` steve_cheng at scotiacapital dot com
2008-11-01 16:19 ` jwakely dot gcc at gmail dot com
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: steve_cheng at scotiacapital dot com @ 2008-05-23 13:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from steve_cheng at scotiacapital dot com 2008-05-23 13:44 -------
Created an attachment (id=15677)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15677&action=view)
-save-temps when compiling C++ testcase
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (4 preceding siblings ...)
2008-05-23 13:45 ` steve_cheng at scotiacapital dot com
@ 2008-11-01 16:19 ` jwakely dot gcc at gmail dot com
2009-11-10 3:47 ` jason at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jwakely dot gcc at gmail dot com @ 2008-11-01 16:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jwakely dot gcc at gmail dot com 2008-11-01 16:18 -------
This is a compile-time test which should fail because undef<T> cannot be
instantiated, but the deallocation function is not used.
#include <stdlib.h>
template <class T> class undef;
struct A {
A() { throw 1; }
};
template<typename T> class Pool { };
template<typename T>
inline void *operator new(size_t size,Pool<T>& pool)
{
return malloc(size);
}
template<typename T>
inline void operator delete(void *p,Pool<T>& pool)
{
undef<T> t;
free(p);
}
int main ()
{
Pool<int> pool;
new (pool) A();
return 0;
}
--
jwakely dot gcc at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jwakely dot gcc at gmail dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (5 preceding siblings ...)
2008-11-01 16:19 ` jwakely dot gcc at gmail dot com
@ 2009-11-10 3:47 ` jason at gcc dot gnu dot org
2009-11-10 18:19 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-10 3:47 UTC (permalink / raw)
To: gcc-bugs
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Keywords| |wrong-code
Last reconfirmed|0000-00-00 00:00:00 |2009-11-10 03:47:06
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (6 preceding siblings ...)
2009-11-10 3:47 ` jason at gcc dot gnu dot org
@ 2009-11-10 18:19 ` jason at gcc dot gnu dot org
2009-11-20 2:32 ` jason at gcc dot gnu dot org
2009-11-20 2:37 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-10 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jason at gcc dot gnu dot org 2009-11-10 18:19 -------
Subject: Bug 34158
Author: jason
Date: Tue Nov 10 18:18:51 2009
New Revision: 154072
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=154072
Log:
PR c++/34158
PR c++/36406
* call.c (non_placement_deallocation_fn_p): Split out...
(build_op_delete_call): ...from here. Use instantiate_type
for placement delete. Simplify logic.
* pt.c (primary_template_instantiation_p): Non-static.
* cp-tree.h: Declare it.
Added:
trunk/gcc/testsuite/g++.dg/init/placement4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (7 preceding siblings ...)
2009-11-10 18:19 ` jason at gcc dot gnu dot org
@ 2009-11-20 2:32 ` jason at gcc dot gnu dot org
2009-11-20 2:37 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-20 2:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from jason at gcc dot gnu dot org 2009-11-20 02:31 -------
Fixed
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/34158] Template delete doesn't call if exception thrown in constructor
2007-11-20 3:50 [Bug c++/34158] New: Template delete doesn't call if exception thrown in constructor andry at inbox dot ru
` (8 preceding siblings ...)
2009-11-20 2:32 ` jason at gcc dot gnu dot org
@ 2009-11-20 2:37 ` jason at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu dot org @ 2009-11-20 2:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jason at gcc dot gnu dot org 2009-11-20 02:37 -------
.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34158
^ permalink raw reply [flat|nested] 11+ messages in thread