Commit 3453b6aa by Steven G. Kargl

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: r257942
parent 55ebc31f
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> 2018-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/84506 PR fortran/84506
......
...@@ -2865,6 +2865,13 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, ...@@ -2865,6 +2865,13 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
for (a = actual; a; a = a->next, f = f->next) 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. */ /* Look for keywords but ignore g77 extensions like %VAL. */
if (a->name != NULL && a->name[0] != '%') if (a->name != NULL && a->name[0] != '%')
{ {
......
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> 2018-02-23 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR fortran/84506 PR fortran/84506
......
...@@ -19,10 +19,6 @@ ...@@ -19,10 +19,6 @@
qofs(s, i) = i * s qofs(s, i) = i * s
i = 42 i = 42
w = qofs(hh, i) w = qofs(hh, i)
! w = qofs(i = i, s = hh) ! { dg-error "invalid in a statement function" }
! 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)
end subroutine step end subroutine step
! { dg-prune-output " Obsolescent feature" } ! { dg-prune-output " Obsolescent feature" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment