public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
[not found] <20040423110112.15097.wolfgang.roehrl@gi-de.com>
@ 2005-08-20 4:33 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-20 4:33 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-08-20 02:43 -------
Here is a self contained testcase for this:
struct B1
{
virtual ~B1 () throw(){}
B1 (){}
int x;
};
struct B2
{
virtual ~B2 () throw(){}
B2 (){}
int x;
};
struct D : B1, B2
{
D (){}
~D () throw(){}
int y;
};
void f1 (D*);
void f2 (B2*);
void f3 (B1*);
int main (void)
{
f1 (::new D);
f2 (::new D);
f3 (::new D);
}
void f1 (D* p) { ::delete p; }
void f2 (B2* p) { ::delete p; }
void f3 (B1* p) { ::delete p; }
With gcc, I get:
free(): invalid pointer 0x9317010!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
[not found] <bug-15097-7154@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2007-09-13 16:04 ` jason at gcc dot gnu dot org
@ 2009-02-05 20:05 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-02-05 20:05 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work|4.3.0 |4.3.0 4.2.2
Target Milestone|--- |4.2.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
[not found] <bug-15097-7154@http.gcc.gnu.org/bugzilla/>
2007-09-05 16:08 ` jason at gcc dot gnu dot org
2007-09-06 1:25 ` jason at gcc dot gnu dot org
@ 2007-09-13 16:04 ` jason at gcc dot gnu dot org
2009-02-05 20:05 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-13 16:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from jason at gcc dot gnu dot org 2007-09-13 16:04 -------
Fixed for 4.2.2 and 4.3.0.
--
jason at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
[not found] <bug-15097-7154@http.gcc.gnu.org/bugzilla/>
2007-09-05 16:08 ` jason at gcc dot gnu dot org
@ 2007-09-06 1:25 ` jason at gcc dot gnu dot org
2007-09-13 16:04 ` jason at gcc dot gnu dot org
2009-02-05 20:05 ` pinskia at gcc dot gnu dot org
3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-06 1:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jason at gcc dot gnu dot org 2007-09-06 01:25 -------
Subject: Bug 15097
Author: jason
Date: Thu Sep 6 01:24:59 2007
New Revision: 128172
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128172
Log:
PR c++/15097
* init.c (build_delete): Use build_headof to get the address of the
complete object if we aren't using the deleting destructor.
* rtti.c (build_headof): No longer static.
* cp-tree.h: Declare it.
Added:
trunk/gcc/testsuite/g++.dg/init/delete2.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/init.c
trunk/gcc/cp/rtti.c
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
[not found] <bug-15097-7154@http.gcc.gnu.org/bugzilla/>
@ 2007-09-05 16:08 ` jason at gcc dot gnu dot org
2007-09-06 1:25 ` jason at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2007-09-05 16:08 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from jason at gcc dot gnu dot org 2007-09-05 16:08 -------
The reduced testcase breaks in the same way with ICC 10.0.023 if I add a
user-defined operator delete to B2. If I add it to D instead, ICC incorrectly
calls the user-defined delete instead of the global delete in the calls to f2
and f3.
This seems to be a standards and/or ABI problem. The standard clearly states
that the global delete will be used if you say ::delete, but the C++ ABI
doesn't provide any mechanism for that. EDG seem to be trying to split the
difference by using the deleting destructor if the static type doesn't have an
operator delete, but that's wrong if the dynamic type of the object does.
It seems that the solution would be to return the true address as void* from a
virtual destructor, or add another deleting destructor that uses the global
operator delete.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
2004-04-23 11:05 [Bug c++/15097] New: code generator problem with ::delete and multiple inheritance wolfgang dot roehrl at de dot gi-de dot com
2004-04-23 13:26 ` [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs pinskia at gcc dot gnu dot org
@ 2004-05-04 19:30 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-04 19:30 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-04 19:30 -------
*** Bug 15283 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |alx_s at hotmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs
2004-04-23 11:05 [Bug c++/15097] New: code generator problem with ::delete and multiple inheritance wolfgang dot roehrl at de dot gi-de dot com
@ 2004-04-23 13:26 ` pinskia at gcc dot gnu dot org
2004-05-04 19:30 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-23 13:26 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-04-23 13:06 -------
Confirmed. We should be using the out-of-control deconstructs here but we are not.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |wrong-code
Known to fail| |2.95.3 3.4.0 3.5.0
Last reconfirmed|0000-00-00 00:00:00 |2004-04-23 13:06:50
date| |
Summary|code generator problem with |code generator problem with
|::delete and multiple |::delete and multiple
|inheritance |inheritance and virtual
| |deconstructs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15097
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-02-05 20:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20040423110112.15097.wolfgang.roehrl@gi-de.com>
2005-08-20 4:33 ` [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs pinskia at gcc dot gnu dot org
[not found] <bug-15097-7154@http.gcc.gnu.org/bugzilla/>
2007-09-05 16:08 ` jason at gcc dot gnu dot org
2007-09-06 1:25 ` jason at gcc dot gnu dot org
2007-09-13 16:04 ` jason at gcc dot gnu dot org
2009-02-05 20:05 ` pinskia at gcc dot gnu dot org
2004-04-23 11:05 [Bug c++/15097] New: code generator problem with ::delete and multiple inheritance wolfgang dot roehrl at de dot gi-de dot com
2004-04-23 13:26 ` [Bug c++/15097] code generator problem with ::delete and multiple inheritance and virtual deconstructs pinskia at gcc dot gnu dot org
2004-05-04 19:30 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).