]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR fortran/84346 (Statement functions should not accept keywords)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 23 Feb 2018 19:41:27 +0000 (19:41 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Fri, 23 Feb 2018 19:41:27 +0000 (19:41 +0000)
2018-02-23  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/84346
* interface.c (compare_actual_formal): Issue error if keyword is
used in a statement function.

2018-02-23  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/84346
* gfortran.dg/statement_function_1.f90: Update test.

From-SVN: r257949

gcc/fortran/ChangeLog
gcc/fortran/interface.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/statement_function_1.f90

index 49930c72b0321f921e73801d629e70bf85578132..0d948e400090fe56d97bd23610579132f096777a 100644 (file)
@@ -1,3 +1,9 @@
+2018-02-23  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/84346
+       * interface.c (compare_actual_formal): Issue error if keyword is
+       used in a statement function.
+
 2018-02-13  Alastair McKinstry  <alastair.mckinstry@sceal.ie>
            Janne Blomqvist  <jb@gcc.gnu.org>
 
index 09ed5ee8161def22bf690b461eaf85927c3a07bb..04b92c994f12fc26ec98c9061007a0cf96681653 100644 (file)
@@ -2739,6 +2739,13 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
 
   for (a = actual; a; a = a->next, f = f->next)
     {
+      if (a->name != NULL && in_statement_function)
+       {
+         gfc_error ("Keyword argument %qs at %L is invalid in "
+                    "a statement function", a->name, &a->expr->where);
+         return false;
+       }
+
       /* Look for keywords but ignore g77 extensions like %VAL.  */
       if (a->name != NULL && a->name[0] != '%')
        {
index e940f712802d177d96399ae535d579d32c17173d..282189c69218a74b4f23ff3fa86681e919543f3b 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-23  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/84346
+       * gfortran.dg/statement_function_1.f90: Update test.
+
 2018-02-21  Sudakshina Das  <sudi.das@arm.com>
 
        Backport from trunk
index f26f25c871295cc08fd7293731a681213a3a7dc8..e717725e67e74289bc1403ef1ebd315a52adf38d 100644 (file)
       qofs(s, i) = i * s
       i = 42
       w = qofs(hh, i)
-!
-! The following line should cause an error, because keywords are not
-! allowed in a function with an implicit interface.
-!
-      w = qofs(i = i, s = hh)
+      w = qofs(i = i, s = hh) ! { dg-error "invalid in a statement function" }
       end subroutine step
 ! { dg-prune-output " Obsolescent feature" }