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] PR23060 - %VAL, %LOC and %REF


On Fri, Dec 29, 2006 at 06:19:59PM +0100, Paul Thomas wrote:
> 2006-12-29  Paul Thomas  <pault@gcc.gnu.org>
> 
> 	PR fortran/23060
> 	* intrinsic.c (compare_actual_formal ): Distinguish argument
> 	list functions from keywords.
> 	* intrinsic.c (sort_actual): If formal is NULL, the presence of
> 	an argument list function actual is an error.
> 	* trans-expr.c (conv_arglist_function) : New function to
> 	implement argument list functions %VAL, %REF and %LOC.
> 	(gfc_conv_function_call): Call it.
> 	* resolve.c (resolve_actual_arglist): Add arg ptype and check
> 	argument list functions.
> 	(resolve_function, resolve_call): Set value of ptype before
> 	calls to resolve_actual_arglist.
> 	* primary.c (match_arg_list_function): New function.
> 	(gfc_match_actual_arglist): Call it before trying for a
> 	keyword argument.
> 
> 2006-12-29  Paul Thomas  <pault@gcc.gnu.org>
> 
> 	PR fortran/23060
> 	* gfortran.dg/c_by_val.c: Called by c_by_val_1.f.
> 	* gfortran.dg/c_by_val_1.f: New test.
> 	* gfortran.dg/c_by_val_2.f: New test.
> 	* gfortran.dg/c_by_val_3.f: New test.

OK with the following comments.

        if (f == NULL)
  	{
! 	  if (a->name[0] == '%')
! 	    gfc_error ("Argument list function at %L is not allowed in this "
! 		       "context.", where);

Remove the period in the error message.  gfortran doesn't
punctuate messages.  Several of the other error messages 
need to also be corrected.

+ conv_arglist_function (gfc_se * se, gfc_expr * expr, const char * name)

Remove whitespace between * and the symbol.

+       gfc_conv_expr (se, expr);
+       /* %VAL is converts argument to default kind.  */

Remove "is".

+ 	  /* This should have been resolved away.  */
+ 	  case BT_UNKNOWN: case BT_CHARACTER: case BT_DERIVED:
+ 	  case BT_PROCEDURE: case BT_HOLLERITH:
+ 	    gfc_error ("Bad type in conv_arglist_function");

If these cases are a "can't possibly happen" type of error,
then gfc_internal_error may be a better choice than gfc_error.

  
+ {
+   char name[GFC_MAX_SYMBOL_LEN + 1];
+   locus g77_locus;
+   match m;
+ 
+   g77_locus = gfc_current_locus;

Any chance, you'll be willing to rename this variable without
the g77 prefix (perhaps, simply loc or old_locus)?

+ cleanup:
+   gfc_current_locus = g77_locus;
+   return m;

-- 
Steve


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