public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning
[not found] <bug-38509-4@http.gcc.gnu.org/bugzilla/>
@ 2011-08-23 18:17 ` meheff at gcc dot gnu.org
2011-08-23 19:32 ` meheff at gcc dot gnu.org
1 sibling, 0 replies; 5+ messages in thread
From: meheff at gcc dot gnu.org @ 2011-08-23 18:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38509
--- Comment #4 from Mark Heffernan <meheff at gcc dot gnu.org> 2011-08-23 18:06:48 UTC ---
Author: meheff
Date: Tue Aug 23 18:06:42 2011
New Revision: 178004
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178004
Log:
2011-08-23 Mark Heffernan <meheff@google.com>
PR middle-end/38509
* common.opt (Wfree-nonheap-object): New option.
* doc/invoke.texi (Warning options): Document -Wfree-nonheap-object.
* builtins.c (maybe_emit_free_warning): Add OPT_Wfree_nonheap_object
to warning.
(expand_builtin): Make warning conditional.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/builtins.c
trunk/gcc/common.opt
trunk/gcc/doc/invoke.texi
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning
[not found] <bug-38509-4@http.gcc.gnu.org/bugzilla/>
2011-08-23 18:17 ` [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning meheff at gcc dot gnu.org
@ 2011-08-23 19:32 ` meheff at gcc dot gnu.org
1 sibling, 0 replies; 5+ messages in thread
From: meheff at gcc dot gnu.org @ 2011-08-23 19:32 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38509
Mark Heffernan <meheff at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|missed-optimization |
Status|UNCONFIRMED |RESOLVED
CC| |meheff at gcc dot gnu.org
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #5 from Mark Heffernan <meheff at gcc dot gnu.org> 2011-08-23 19:27:18 UTC ---
With patch, warning is controllable with -Wfree-nonheap-object.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning
2008-12-12 22:37 [Bug c++/38509] New: " rubidium at openttd dot org
2008-12-12 22:46 ` [Bug middle-end/38509] " pinskia at gcc dot gnu dot org
2009-07-25 23:29 ` rubidium at openttd dot org
@ 2009-07-25 23:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-07-25 23:32 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2009-07-25 23:32 -------
This case needs the compiler needs to know that TestCase::TestCase():: non_heap
cannot change value.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38509
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning
2008-12-12 22:37 [Bug c++/38509] New: " rubidium at openttd dot org
2008-12-12 22:46 ` [Bug middle-end/38509] " pinskia at gcc dot gnu dot org
@ 2009-07-25 23:29 ` rubidium at openttd dot org
2009-07-25 23:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 5+ messages in thread
From: rubidium at openttd dot org @ 2009-07-25 23:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rubidium at openttd dot org 2009-07-25 23:28 -------
Is there a way to disable this warning?
I've searched the manual and gcc -v --help for 'heap' and 'free'. Neither
keyword showed any promising compiler flags.
I've also looked in the code, but I cannot find a variable (like
warn_parentheses) that enables/disables the warning.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38509
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning
2008-12-12 22:37 [Bug c++/38509] New: " rubidium at openttd dot org
@ 2008-12-12 22:46 ` pinskia at gcc dot gnu dot org
2009-07-25 23:29 ` rubidium at openttd dot org
2009-07-25 23:32 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-12 22:46 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2008-12-12 22:42 -------
static int non_heap = 0;
<bb 2>:
if (non_heap != 0)
goto <bb 3>;
else
goto <bb 4>;
<bb 3>:
__builtin_free (&non_heap);
Hmm, since the address of non_heap is taken, we don't optimize away the
conditional.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |middle-end
Keywords| |diagnostic, missed-
| |optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38509
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-23 19:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-38509-4@http.gcc.gnu.org/bugzilla/>
2011-08-23 18:17 ` [Bug middle-end/38509] Bogus "attempt to free a non-heap object" warning meheff at gcc dot gnu.org
2011-08-23 19:32 ` meheff at gcc dot gnu.org
2008-12-12 22:37 [Bug c++/38509] New: " rubidium at openttd dot org
2008-12-12 22:46 ` [Bug middle-end/38509] " pinskia at gcc dot gnu dot org
2009-07-25 23:29 ` rubidium at openttd dot org
2009-07-25 23:32 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).