This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules,equivalences and commons - final(?) version


Paul Thomas wrote:
> *************** gfc_match_common (void)
> *** 2354,2361 ****
> --- 2355,2400 ----
...
> + 			  gfc_error ("Symbol '%s', in COMMON block '%s' at "
> + 				     "%C is being indirectly equivalenced to "
> + 				     "another COMMON block '%s'"
> + 				     , sym->name
> + 				     , sym->common_head->name
> + 				     , other->common_head->name);

Here and in gfc_match_equivalence, you show this peculiar way of arranging the
commas.  Please put them on the preceding line.

> --- 2618,2633 ----
>   	goto syntax;
>   
>         set = eq;
> +       common_flag = FALSE;
>   
>         for (;;)
>   	{
> ! 	  m = gfc_match_equiv_variable (&set->expr, 1);
>   	  if (m == MATCH_ERROR)
>   	    goto cleanup;
>   	  if (m == MATCH_NO)
>   	    goto syntax;
> + 	  m = gfc_match_variable (&set->expr, 1);
>   
>   	  for (ref = set->expr->ref; ref; ref = ref->next)
>   	    if (ref->type == REF_ARRAY && ref->u.ar.type == AR_SECTION)

I believe the call to gfc_match_variable is an error.  It looks like you're
allowing something like
   EQUIVALENCE(A(5)B(3),C)
silently ignoring the syntax error, only adding b and c to the equivalence.

> *************** gfc_match_variable (gfc_expr ** result, 
> *** 2258,2260 ****
> --- 2263,2278 ----
>     *result = expr;
>     return MATCH_YES;
>   }
> + 
> + match
> + gfc_match_variable (gfc_expr ** result, int equiv_flag)
> + {
> +   return match_variable (result, equiv_flag, 1);
> + }
> + 
> + match
> + gfc_match_equiv_variable (gfc_expr ** result, int equiv_flag)
> + {
> +   return match_variable (result, equiv_flag, 0);
> + }
> + 

I don't think having gfc_match_equiv_variable with a parameter "equiv_flag"
makes much sense.  Either name the function gfc_match_local_variable (or
something which expresses "not host-associated" more clearly), if you think
there might be other uses for this function, or do away with equiv_flag, as it
will always be set.

Otherwise I think this patch is ok.

- Tobi


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