This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR20244 - Ping - also cures PR25391
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Paul Thomas <paulthomas2 at wanadoo dot fr>
- Cc: THOMAS Paul Richard 169137 <paul dot richard dot thomas at cea dot fr>, "'gcc-patches at gcc dot gnu dot org'" <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Thu, 15 Dec 2005 12:57:40 -0500
- Subject: Re: [Patch, fortran] PR20244 - Ping - also cures PR25391
- References: <756DFD3DE8F1D411A59A00306E06E84702C42963@drfccad.cad.cea.fr> <43A1AC87.1040109@wanadoo.fr>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Dec 15, 2005 at 06:48:55PM +0100, Paul Thomas wrote:
> >--- gcc/fortran/trans-types.c (révision 108398)
> >+++ gcc/fortran/trans-types.c (copie de travail)
> >@@ -1402,9 +1402,37 @@
> >{
> > tree typenode, field, field_type, fieldlist;
> > gfc_component *c;
> >+ gfc_component * cm = NULL;
> >+ gfc_symtree * symtree = NULL;
> >+ gfc_symbol * dt = NULL;
> >+ gfc_namespace * ns = NULL;
Just a code style note, I think it would be better to move the decls
down where they are used and you certainly don't need to initialize most of
them to NULL. So something like
/* If a derived type is already available by host association,
use its backend declaration and those of its components,
rather than building anew so that potential dummy and actual
arguments use the same TREE_TYPE. (PR20244) */
if (derived->attr.use_assoc && derived->ns->parent != NULL)
{
gfc_namespace *ns;
for (ns = derived->ns->parent; ns; ns = ns->parent)
{
gfc_symtree *symtree;
gfc_symbol *dt;
symtree = gfc_find_symtree (ns->sym_root, derived->name);
if (!symtree)
continue;
dt = symtree->n.sym;
if (dt
&& dt->attr.flavor == FL_DERIVED
&& dt->module == derived->module
&& dt->backend_decl)
{
gfc_component *cm = dt->components;
derived->backend_decl = dt->backend_decl;
c = derived->components;
for (; c; c = c->next, cm = cm->next)
c->backend_decl = cm->backend_decl;
}
}
}
but perhaps other disagree.
Jakub