[Bug c/54202] Overeager warning about freeing non-heap objects
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Aug 8 14:00:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54202
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-08-08
Ever Confirmed|0 |1
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-08 13:59:58 UTC ---
Confirmed. This way it becomes an always may-be warning because a function
may not actually be executed (apart from main()). Almost all warnings behave
this way btw. GCC is in this case seeing
free (&shared_null);
and considers this a good thing to warn on.
So would you consider printing
warning: possible attempt to free a non-heap object 'shared_null'
a fix? Unconditionally, as we really cannot prove a line of code _will_
be executed at runtime (we can replace the free by an abort call though ...).
More information about the Gcc-bugs
mailing list