diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 43d7519d13a..950a0ee4564 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-01-06 Tobias Burnus + + PR fortran/34660 + * resolve.c (resolve_formal_arglist): Reject dummy procedure in + ELEMENTAL functions. + 2008-01-06 Tobias Burnus PR fortran/34662 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 8fc679d9145..e4f7dcbac4a 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -225,6 +225,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. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5cecf0642e6..5036598e140 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-01-06 Tobias Burnus + + PR fortran/34660 + * gfortran.dg/elemental_args_check_2.f90: New. + 2008-01-06 Tobias Burnus PR fortran/34662 diff --git a/gcc/testsuite/gfortran.dg/elemental_args_check_2.f90 b/gcc/testsuite/gfortran.dg/elemental_args_check_2.f90 new file mode 100644 index 00000000000..51e69a49ee4 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/elemental_args_check_2.f90 @@ -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