This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR20244 - Ping - also cures PR25391


Jakub Jelinek wrote:

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




That's the way that I had it in the first place, before submitting! It's OK by me.

Paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]