This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14885] Improper delete/free of local variables undetected
- From: "ndeb at ece dot cmu dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Apr 2004 20:11:18 -0000
- Subject: [Bug c++/14885] Improper delete/free of local variables undetected
- References: <20040408003907.14885.ndeb@ece.cmu.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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