diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2008-03-19 15:13:48 -0400 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2008-03-19 15:13:48 -0400 |
commit | ac05557cc7402b73c098179049cad48da07c52dc (patch) | |
tree | 0fd5d21fbc5fc9e2c3867a8b8ae443788b555330 | |
parent | 2f3b8279bf70fcd8c74b911c9d6d953bc1edd06e (diff) | |
download | gcc-ac05557cc7402b73c098179049cad48da07c52dc.zip gcc-ac05557cc7402b73c098179049cad48da07c52dc.tar.gz gcc-ac05557cc7402b73c098179049cad48da07c52dc.tar.bz2 |
re PR fortran/35152 (Implicit procedure with keyword=argument is accepted)
gcc/fortran:
2008-03-19 Daniel Franke <franke.daniel@gmail.com>
PR fortran/35152
* interface.c (gfc_procedure_use): Check for keyworded arguments in
procedures without explicit interfaces.
gcc/testsuite:
2008-03-19 Daniel Franke <franke.daniel@gmail.com>
PR fortran/35152
* gfortran.dg/argument_checking_16.f90: New test.
From-SVN: r133347
-rw-r--r-- | gcc/fortran/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/argument_checking_16.f90 | 9 |
4 files changed, 40 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 08f1a8c..9254562 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-03-19 Daniel Franke <franke.daniel@gmail.com> + + PR fortran/35152 + * interface.c (gfc_procedure_use): Check for keyworded arguments in + procedures without explicit interfaces. + 2008-03-16 Paul Thomas <pault@gcc.gnu.org> PR fortran/35470 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 4cee386..09f7238 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2419,9 +2419,26 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) } } - if (sym->attr.if_source == IFSRC_UNKNOWN - || !compare_actual_formal (ap, sym->formal, 0, - sym->attr.elemental, where)) + if (sym->attr.external + || sym->attr.if_source == IFSRC_UNKNOWN) + { + gfc_actual_arglist *a; + for (a = *ap; a; a = a->next) + { + /* Skip g77 keyword extensions like %VAL, %REF, %LOC. */ + if (a->name != NULL && a->name[0] != '%') + { + gfc_error("Keyword argument requires explicit interface " + "for procedure '%s' at %L", sym->name, &a->expr->where); + break; + } + } + + return; + } + + if (!compare_actual_formal (ap, sym->formal, 0, + sym->attr.elemental, where)) return; check_intents (sym->formal, *ap); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0781ed5..6557c0c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-03-19 Daniel Franke <franke.daniel@gmail.com> + + PR fortran/35152 + * gfortran.dg/argument_checking_16.f90: New test. + 2008-03-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR libfortran/32972 diff --git a/gcc/testsuite/gfortran.dg/argument_checking_16.f90 b/gcc/testsuite/gfortran.dg/argument_checking_16.f90 new file mode 100644 index 0000000..75b2ece --- /dev/null +++ b/gcc/testsuite/gfortran.dg/argument_checking_16.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! PR fortran/35152 - implicit procedure with keyword=argument + +external bar + +call bar(a=5) ! { dg-error "requires explicit interface" } +call foo(a=5) ! { dg-error "requires explicit interface" } +end + |