[Bug c++/14885] Improper delete/free of local variables undetected
ndeb at ece dot cmu dot edu
gcc-bugzilla@gcc.gnu.org
Thu Apr 8 20:11:00 GMT 2004
------- Additional Comments From ndeb at ece dot cmu dot edu 2004-04-08 20:11 -------
(In reply to comment #3)
> I personally think that a) this problem is so easily detected at run-time
> that it does not merit much compiler hacking, and
That was one of the suggestions made by Giovanni Bajo so nothing new here.
> b) this is simply too
> stupid a user error that we have to bother; I'm sure it doesn't happen
> very often in practice.
My idea of a bug report is not to post the most complicated thousand line code
to reproduce a bug that can be reproduced with 5 lines.
> The point being is that we could probably detect the case you present, but
> then people want us to also warn for cases like
>
> void f(char *p) {
> char c;
> char *x;
> if (bar())
> x = &c;
> else
> x = p;
> delete x;
> }
> and that's something that will be much harder to detect in all variations.
Thats exactly why this bug is a real bug.
> I propose we close this PR.
Not sure what "PR" means but whats the logic behind sweeping it under the
carpet ?
>
> W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14885
More information about the Gcc-bugs
mailing list