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]

[Patch, Fortran] PR34660 - reject dummy procedures in ELEMENTAL procedures


C1277 All dummy arguments of an elemental procedure shall be scalar
dummy data objects and shall not have the POINTER or ALLOCATABLE
attribute.

Build and regtested on x86-64-linux.
OK for the trunk?

Tobias Burnus
2008-01-05  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34660
	* resolve.c (resolve_formal_arglist): Reject dummy procedure in
	ELEMENTAL functions.

2008-01-05  Tobias Burnus  <burnus@net-b.de>

	PR fortran/34660
	* gfortran.dg/elemental_args_check_2.f90: New.

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c	(revision 131332)
+++ gcc/fortran/resolve.c	(working copy)
@@ -225,6 +226,14 @@ resolve_formal_arglist (gfc_symbol *proc
 			 &sym->declared_at);
 	      continue;
 	    }
+
+	  if (sym->attr.flavor == FL_PROCEDURE)
+	    {
+	      gfc_error ("Dummy procedure '%s' not allowed in elemental "
+			 "procedure '%s' at %L", sym->name, proc->name,
+			 &sym->declared_at);
+	      continue;
+	    }
 	}
 
       /* Each dummy shall be specified to be scalar.  */
Index: gcc/testsuite/gfortran.dg/elemental_args_check_2.f90
===================================================================
--- gcc/testsuite/gfortran.dg/elemental_args_check_2.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/elemental_args_check_2.f90	(revision 0)
@@ -0,0 +1,19 @@
+! { dg-do compile }
+!
+! PR fortran/34660
+!
+! Check for elemental constrain C1277 (F2003).
+! Contributed by Joost VandeVondele.
+!
+MODULE M1
+IMPLICIT NONE
+CONTAINS
+ PURE ELEMENTAL SUBROUTINE S1(I,F)
+   INTEGER, INTENT(IN) :: I
+   INTERFACE
+     PURE INTEGER FUNCTION F(I) ! { dg-error "Dummy procedure 'f' not allowed in elemental procedure" }
+      INTEGER, INTENT(IN) :: I
+     END FUNCTION F
+   END INTERFACE
+ END SUBROUTINE S1
+END MODULE M1

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