re PR fortran/25071 (dummy argument larger than actual argument)

2017-09-29  Dominique d'Humieres  <dominiq@lps.ens.fr>

	PR fortran/25071
	* interface.c (compare_actual_formal): Change warnings to errors
	when "Actual argument contains too few elements for dummy
	argument", unless -std=legacy is used.

From-SVN: r253286
This commit is contained in:
Dominique d'Humieres 2017-09-29 15:15:26 +02:00 committed by Dominique d'Humieres
parent 20ad05861e
commit 37d92a7e0e
2 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,10 @@
2017-09-29 Dominique d'Humieres <dominiq@lps.ens.fr>
PR fortran/25071
* interface.c (compare_actual_formal): Change warnings to errors
when "Actual argument contains too few elements for dummy
argument", unless -std=legacy is used.
2017-09-27 Thomas Schwinge <thomas@codesourcery.com>
* lang.opt <Wdo-subscript>: End help text with a period.

View File

@ -2991,11 +2991,20 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal,
f->sym->name, actual_size, formal_size,
&a->expr->where);
else if (where)
gfc_warning (OPT_Wargument_mismatch,
"Actual argument contains too few "
"elements for dummy argument %qs (%lu/%lu) at %L",
f->sym->name, actual_size, formal_size,
&a->expr->where);
{
/* Emit a warning for -std=legacy and an error otherwise. */
if (gfc_option.warn_std == 0)
gfc_warning (OPT_Wargument_mismatch,
"Actual argument contains too few "
"elements for dummy argument %qs (%lu/%lu) "
"at %L", f->sym->name, actual_size,
formal_size, &a->expr->where);
else
gfc_error_now ("Actual argument contains too few "
"elements for dummy argument %qs (%lu/%lu) "
"at %L", f->sym->name, actual_size,
formal_size, &a->expr->where);
}
return false;
}