diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 822dcd0da30..d8cd7060e08 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2005-04-28 Francois-Xavier Coudert + + PR fortran/20865 + * resolve.c (resolve_actual_arglist): Issue an error if a statement + functions is used as actual argument. + 2005-04-27 Francois-Xavier Coudert PR fortran/21177 diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index d75704bc8e2..a4667b7a5c0 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -604,6 +604,12 @@ resolve_actual_arglist (gfc_actual_arglist * arg) || sym->attr.external) { + if (sym->attr.proc == PROC_ST_FUNCTION) + { + gfc_error ("Statement function '%s' at %L is not allowed as an " + "actual argument", sym->name, &e->where); + } + /* If the symbol is the function that names the current (or parent) scope, then we really have a variable reference. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1f7bc01814d..0d418527f79 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-04-28 Francois-Xavier Coudert + + PR fortran/20865 + * gfortran.dg/pr20865.f90: New test. + 2005-04-28 Joseph S. Myers * gcc.dg/void-cast-2.c: New test. diff --git a/gcc/testsuite/gfortran.dg/pr20865.f90 b/gcc/testsuite/gfortran.dg/pr20865.f90 new file mode 100644 index 00000000000..96d0d791cb0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr20865.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/20865 + subroutine tt(j) + integer :: j + end subroutine + + integer :: i, st + st(i) = (i*i+2) + call tt(st) ! { dg-error "Statement function .* is not allowed as an actual argument" } + end