This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: an interesting g++ new/delete bug -- only defining half the set


> From: Brendan Kehoe <brendan@cygnus.com>
> Date: Tue, 25 Aug 1998 19:50:41 -0700 (PDT)
> To: egcs-bugs@cygnus.com

> What it will very subtly do is call your redefined operator new, but
> then call your builtin operator delete.

> Any thoughts on a productive way to make the compiler see that this is
> happening, and suitably warn about it?

Sure, all you have to do is a link time analysis package that ensures
either both new and delete come from user land, or come from the
system library, but not both.  If you wanted a hard error, you can put
new and delete in one object.  The user would get link errors about
redefs if they failed do this.

> Like have both build_new and build_delete do a DECL_BUILT_IN check
> between what would be called for that type, versus what will
> probably be used for its opposite?  Hmm...

Nope, in general this can't work.  In a very limited case, it can
catch some things.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]