This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/54202] Overeager warning about freeing non-heap objects
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 08 Aug 2012 13:59:58 +0000
- Subject: [Bug c/54202] Overeager warning about freeing non-heap objects
- Auto-submitted: auto-generated
- References: <bug-54202-4@http.gcc.gnu.org/bugzilla/>
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 ...).