re PR fortran/20865 (statement function shall not be supplied as procedure argument)
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Thu, 28 Apr 2005 11:56:08 +0000 (13:56 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Thu, 28 Apr 2005 11:56:08 +0000 (11:56 +0000)
PR fortran/20865
* resolve.c (resolve_actual_arglist): Issue an error if a statement
functions is used as actual argument.
* gfortran.dg/pr20865.f90: New test.

From-SVN: r98919

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr20865.f90 [new file with mode: 0644]

index 822dcd0da30ea9babe46205aba8093469b5bb243..d8cd7060e081a085b028db1397a7e7d50a764cce 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-28  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       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  <coudert@clipper.ens.fr>
 
        PR fortran/21177
index d75704bc8e2f2128a0c14b0dbaaac44463a3e05b..a4667b7a5c04a9c119ed09ff732fcd0dd259c920 100644 (file)
@@ -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.  */
 
index 1f7bc01814d9734a1d2f6e4d78e90884bfd1096e..0d418527f796c8553cb0daec62f760f8a7dae784 100644 (file)
@@ -1,3 +1,8 @@
+2005-04-28  Francois-Xavier Coudert  <coudert@clipper.ens.fr>
+
+       PR fortran/20865
+       * gfortran.dg/pr20865.f90: New test.
+
 2005-04-28  Joseph S. Myers  <joseph@codesourcery.com>
 
        * 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 (file)
index 0000000..96d0d79
--- /dev/null
@@ -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