This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix memory leak in Fortran FE with init_emit (take 2)
On Thu, Aug 23, 2012 at 11:24:26AM +0200, Richard Guenther wrote:
> > Perhaps it would make sense to commit the fortran/ change separately to fix
> > the leak in there, and resolve the rest in a follow-up when it is clear what
> > to do in the C++ FE.
>
> Yes. Does the copy_node change pass testing? If so then installing it
> would be nice as well.
The whole patch passed testing, but in the C++ FE (the cp/decl.c) it is
probably just a partial fix or even wrong fix (e.g., even when we don't
allocate a new cfun there, we still overwrite cfun->language with newly
GCed memory, etc.
So I'm going to commit now the tree.c and trans-decl.c hunks and
will leave the rest for later.
> > 2012-08-23 Jakub Jelinek <jakub@redhat.com>
> >
> > * function.c (allocate_struct_function): Assert that
> > DECL_STRUCT_FUNCTION (fndecl) is NULL.
> > * tree.c (copy_node_stat): Clear DECL_STRUCT_FUNCTION.
> > fortran/
> > * trans-decl.c (trans_function_start, generate_coarray_init,
> > create_main_function, gfc_generate_constructors): Call
> > allocate_struct_function instead of init_function_start.
> > cp/
> > * decl.c (start_preparsed_function): Don't call
> > allocate_struct_function if already allocated.
Jakub