[Bug c++/14885] Improper delete/free of local variables undetected

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Thu Apr 8 18:43:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-04-08 18:43 -------
I personally think that a) this problem is so easily detected at run-time
that it does not merit much compiler hacking, and 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.

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.

I propose we close this PR.

W.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14885



More information about the Gcc-bugs mailing list