public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch, fortran] PR35152 - Implicit procedure with keyword=argument
@ 2008-03-16 14:16 Daniel Franke
  2008-03-18 15:29 ` Tobias Burnus
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Franke @ 2008-03-16 14:16 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]


Procedures without explicit interfaces accept keyworded arguments without 
note. 


gcc/fortran:
2008-03-16  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/35152
	* intreface.c (gfc_procedure_use): Check for keyworded arguments in
	procedures without explicit interfaces.

gcc/testsuite:
2008-03-16  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/35152
	* gfortran.dg/argument_checking_16.f90: New test.


Regression tested on i686-pc-linux-gnu. Ok for trunk?

Regards

	Daniel

[-- Attachment #2: pr35152.diff --]
[-- Type: text/x-diff, Size: 1483 bytes --]

Index: fortran/interface.c
===================================================================
--- fortran/interface.c	(revision 133243)
+++ fortran/interface.c	(working copy)
@@ -2419,9 +2419,26 @@ gfc_procedure_use (gfc_symbol *sym, gfc_
 	}
     }
 
-  if (sym->attr.if_source == IFSRC_UNKNOWN
-      || !compare_actual_formal (ap, sym->formal, 0,
-				 sym->attr.elemental, where))
+  if (sym->attr.external
+      || sym->attr.if_source == IFSRC_UNKNOWN)
+    {
+      gfc_actual_arglist *a;
+      for (a = *ap; a; a = a->next)
+	{
+	  /* Skip g77 keyword extensions like %VAL, %REF, %LOC.  */
+	  if (a->name != NULL && a->name[0] != '%')
+	    {
+	      gfc_error("Keyword argument requires explicit interface "
+			"for procedure '%s' at %L", sym->name, &a->expr->where);
+	      break;
+	    }
+	}
+
+      return;
+    }
+
+  if (!compare_actual_formal (ap, sym->formal, 0,
+			      sym->attr.elemental, where))
     return;
 
   check_intents (sym->formal, *ap);
Index: testsuite/gfortran.dg/argument_checking_16.f90
===================================================================
--- testsuite/gfortran.dg/argument_checking_16.f90	(revision 0)
+++ testsuite/gfortran.dg/argument_checking_16.f90	(revision 0)
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! PR fortran/35152 - implicit procedure with keyword=argument
+
+external bar
+
+call bar(a=5)       ! { dg-error "requires explicit interface" }
+call foo(a=5)       ! { dg-error "requires explicit interface" }
+end
+

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch, fortran] PR35152 - Implicit procedure with keyword=argument
  2008-03-16 14:16 [patch, fortran] PR35152 - Implicit procedure with keyword=argument Daniel Franke
@ 2008-03-18 15:29 ` Tobias Burnus
  0 siblings, 0 replies; 2+ messages in thread
From: Tobias Burnus @ 2008-03-18 15:29 UTC (permalink / raw)
  To: Daniel Franke; +Cc: fortran, gcc-patches

Daniel Franke wrote:
> Procedures without explicit interfaces accept keyworded arguments without 
> note.
>
> gcc/fortran:
> 2008-03-16  Daniel Franke  <franke.daniel@gmail.com>
>
> 	PR fortran/35152
> 	* intreface.c (gfc_procedure_use): Check for keyworded arguments in
> 	procedures without explicit interfaces.
>
> gcc/testsuite:
> 2008-03-16  Daniel Franke  <franke.daniel@gmail.com>
>
> 	PR fortran/35152
> 	* gfortran.dg/argument_checking_16.f90: New test.
>
>
> Regression tested on i686-pc-linux-gnu. Ok for trunk?
OK. Thanks for the patch.

Tobias

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-18 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-16 14:16 [patch, fortran] PR35152 - Implicit procedure with keyword=argument Daniel Franke
2008-03-18 15:29 ` Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).