This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [google gcc-4_7, integration] Scribble on destructed strings to catch invalid accesses.


On Thu, 24 Jan 2013, Chris Jefferson wrote:

On 24/01/13 19:03, Marc Glisse wrote:
On Wed, 23 Jan 2013, Paul Pluzhnikov wrote:

This patch allows us to catch use of destructed strings.

Hello,


while a number of the google debug patches are just cheaper versions (that don't break the ABI) of what libstdc++'s debug mode provides, this overwriting of classes on destruction is not as obviously redundant, and I wonder whether something like it (done consistently for many classes) could go to trunk...

A possibly crazy suggestion.. How hard would it be to add this automatically to all calls to destructors? (via a command line flag obviously)

Now that you say it, I think I've heard it suggested before :-) Or maybe it was overwriting pointers after a call to delete.


It doesn't sound very hard (I could of course be wrong). One issue is that when the destructor is manually called (for an object created with placement new), it could break code, and although such code would be dubious, I am not 100% sure if it is necessarily illegal (probably is). I am not sure how it would interact with optimizations either, if gcc would remove just the ones it can prove are useless, or all of them.

--
Marc Glisse


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