From: Dominique d'Humieres Date: Fri, 29 Sep 2017 13:15:26 +0000 (+0200) Subject: re PR fortran/25071 (dummy argument larger than actual argument) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37d92a7e0ec5587f7cd52ac05b084ea9486d341d;p=gcc.git re PR fortran/25071 (dummy argument larger than actual argument) 2017-09-29 Dominique d'Humieres 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index c6980148778..b0c9c808cb4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2017-09-29 Dominique d'Humieres + + 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 * lang.opt : End help text with a period. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index fb6db21449d..f8ef33fc778 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -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; }