diff options
author | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-08-15 22:52:40 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2019-08-15 22:52:40 +0000 |
commit | fb078366c749168c86a97df8423eb0b8f2c948b2 (patch) | |
tree | a1402a54686f1b73e81b7548effd9221a7061b04 /gcc/fortran/interface.c | |
parent | 7148dede8a84e17cc0b00190d76fabbc1a717654 (diff) | |
download | gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.zip gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.tar.gz gcc-fb078366c749168c86a97df8423eb0b8f2c948b2.tar.bz2 |
re PR fortran/91443 (-Wargument-mismatch does not catch mismatch for global procedure)
2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91443
* frontend-passes.c (check_externals_expr): New function.
(check_externals_code): New function.
(gfc_check_externals): New function.
* gfortran.h (debug): Add prototypes for gfc_symbol * and
gfc_expr *.
(gfc_check_externals): Add prototype.
* interface.c (compare_actual_formal): Do not complain about
alternate returns if the formal argument is optional.
(gfc_procedure_use): Handle cases when an error has been issued
previously. Break long line.
* parse.c (gfc_parse_file): Call gfc_check_externals for all
external procedures.
* resolve.c (resolve_global_procedure): Remove checking of
argument list.
2019-08-15 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/91443
* gfortran.dg/argument_checking_19.f90: New test.
* gfortran.dg/altreturn_10.f90: Change dg-warning to dg-error.
* gfortran.dg/dec_union_11.f90: Add -std=legacy.
* gfortran.dg/hollerith8.f90: Likewise. Remove warning for
Hollerith constant.
* gfortran.dg/integer_exponentiation_2.f90: New subroutine gee_i8;
use it to avoid type mismatches.
* gfortran.dg/pr41011.f: Add -std=legacy.
* gfortran.dg/whole_file_1.f90: Change warnings to errors.
* gfortran.dg/whole_file_2.f90: Likewise.
From-SVN: r274551
Diffstat (limited to 'gcc/fortran/interface.c')
-rw-r--r-- | gcc/fortran/interface.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 1d14f83..d6f6cce 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2979,10 +2979,15 @@ compare_actual_formal (gfc_actual_arglist **ap, gfc_formal_arglist *formal, if (a->expr == NULL) { - if (where) - gfc_error_now ("Unexpected alternate return specifier in " - "subroutine call at %L", where); - return false; + if (f->sym->attr.optional) + continue; + else + { + if (where) + gfc_error_now ("Unexpected alternate return specifier in " + "subroutine call at %L", where); + return false; + } } /* Make sure that intrinsic vtables exist for calls to unlimited @@ -3723,6 +3728,9 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) for (a = *ap; a; a = a->next) { + if (a->expr && a->expr->error) + return false; + /* Skip g77 keyword extensions like %VAL, %REF, %LOC. */ if (a->name != NULL && a->name[0] != '%') { @@ -3738,6 +3746,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) gfc_error ("Assumed-type argument %s at %L requires an explicit " "interface", a->expr->symtree->n.sym->name, &a->expr->where); + a->expr->error = 1; break; } @@ -3751,6 +3760,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) gfc_error ("Actual argument of LOCK_TYPE or with LOCK_TYPE " "component at %L requires an explicit interface for " "procedure %qs", &a->expr->where, sym->name); + a->expr->error = 1; break; } @@ -3764,13 +3774,16 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) gfc_error ("Actual argument of EVENT_TYPE or with EVENT_TYPE " "component at %L requires an explicit interface for " "procedure %qs", &a->expr->where, sym->name); + a->expr->error = 1; break; } if (a->expr && a->expr->expr_type == EXPR_NULL && a->expr->ts.type == BT_UNKNOWN) { - gfc_error ("MOLD argument to NULL required at %L", &a->expr->where); + gfc_error ("MOLD argument to NULL required at %L", + &a->expr->where); + a->expr->error = 1; return false; } @@ -3780,6 +3793,7 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) { gfc_error ("Assumed-rank argument requires an explicit interface " "at %L", &a->expr->where); + a->expr->error = 1; return false; } } |