re PR fortran/84346 (Statement functions should not accept keywords)

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: r257946
This commit is contained in:
Steven G. Kargl 2018-02-23 19:35:51 +00:00
parent e6edd7f791
commit 3a2e1e322b
4 changed files with 19 additions and 5 deletions

View 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-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk

View File

@ -2821,6 +2821,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] != '%')
{

View 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-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from trunk

View File

@ -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" }