https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99714
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|dmalcolm at gcc dot gnu.org |unassigned at gcc dot
gnu.org
Component|analyzer |middle-end
Keywords|documentation |diagnostic
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The C test case (corrected below) is meant to allocate and deallocate the the
member pointer, just like the C++ test case.
I also raise this as an enhancement for the -Wmismatched-dealloc and
Wmismatched-new-delete warnings (hence Changing component back to middle-end),
although I think it would be worthwhile improvement to the analyzer as well.
I'm not sure what the best way is to track enhancements to both kinds of
warnings. Clone one to the other?
struct A { int *p; };
void dealloc (void*);
__attribute__ ((malloc (dealloc))) void* alloc (int);
void init (struct A *p, int n) { p->p = alloc (n * sizeof *p); }
void fini (struct A *p)
{
__builtin_free (p->p); // missing -Wmismatched-dealloc
}
#endif