public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* delete not called
@ 1998-04-16 23:59 Tudor Hulubei
  1998-04-17  7:07 ` Warner Losh
  0 siblings, 1 reply; 4+ messages in thread
From: Tudor Hulubei @ 1998-04-16 23:59 UTC (permalink / raw)
  To: egcs

Hi there,

I think there is a bug in recent snapshots of egcs.  For the appended
example there is no call to operator delete generated for objects of
type Y, so the output looks like:

new: 0x8049928
new: 0x8049938
delete: 0x8049928

gcc-2.8.1 & gcc-2.7.2.3 (and I believe older snapshots of egcs) do
generate the call.

Is this a known problem?

Thanks,
Tudor

P.S.  The version I use is:
Reading specs from /home/tudor/usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.22/specs
gcc version egcs-2.91.22 980404 (gcc2 ss-980401 experimental)

#include <new>
#include <iostream.h>
#include <stdlib.h>

void *operator new(size_t size)
{
    if (void *ptr = malloc(size)) {
	cerr << "new: " << ptr << endl;
	return ptr;
    }
}

void operator delete(void *ptr)
{
    if (ptr) {
	cerr << "delete: " << ptr << endl;
	free(ptr);
    }
}

class X { public: ~X() {} };
class Y : public X {};

int
main()
{
    X *x = new X();
    Y *y = new Y();

    delete x;
    delete y;
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1998-04-17 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-16 23:59 delete not called Tudor Hulubei
1998-04-17  7:07 ` Warner Losh
1998-04-17 14:42   ` Tudor Hulubei
1998-04-17 14:49   ` Tudor Hulubei

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