From: Steven G. Kargl Date: Fri, 23 Feb 2018 19:41:27 +0000 (+0000) Subject: re PR fortran/84346 (Statement functions should not accept keywords) X-Git-Tag: releases/gcc-6.5.0~508 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09d92ba2e7a0ab6690e275b502c9d2bf349f4c56;p=thirdparty%2Fgcc.git re PR fortran/84346 (Statement functions should not accept keywords) 2018-02-23 Steven G. Kargl PR fortran/84346 * interface.c (compare_actual_formal): Issue error if keyword is used in a statement function. 2018-02-23 Steven G. Kargl PR fortran/84346 * gfortran.dg/statement_function_1.f90: Update test. From-SVN: r257949 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 49930c72b032..0d948e400090 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2018-02-23 Steven G. Kargl + + PR fortran/84346 + * interface.c (compare_actual_formal): Issue error if keyword is + used in a statement function. + 2018-02-13 Alastair McKinstry Janne Blomqvist diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 09ed5ee8161d..04b92c994f12 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -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] != '%') { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e940f712802d..282189c69218 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-02-23 Steven G. Kargl + + PR fortran/84346 + * gfortran.dg/statement_function_1.f90: Update test. + 2018-02-21 Sudakshina Das Backport from trunk diff --git a/gcc/testsuite/gfortran.dg/statement_function_1.f90 b/gcc/testsuite/gfortran.dg/statement_function_1.f90 index f26f25c87129..e717725e67e7 100644 --- a/gcc/testsuite/gfortran.dg/statement_function_1.f90 +++ b/gcc/testsuite/gfortran.dg/statement_function_1.f90 @@ -19,10 +19,6 @@ 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" }