diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-01-21 13:42:11 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2020-01-21 13:42:11 +0100 |
commit | b31f80231df9ce6d9b50c62d28b8d2a4654ef564 (patch) | |
tree | 4fed8ba69e42c7298df480644c45beb4a0fdfcdc /gcc | |
parent | 01e9f1812c72c940172700971179d7726b7a3050 (diff) | |
download | gcc-b31f80231df9ce6d9b50c62d28b8d2a4654ef564.zip gcc-b31f80231df9ce6d9b50c62d28b8d2a4654ef564.tar.gz gcc-b31f80231df9ce6d9b50c62d28b8d2a4654ef564.tar.bz2 |
Fortran] PR93309 – permit repeated 'implicit none(external)'
PR fortran/93309
* interface.c (gfc_procedure_use): Also check parent namespace for
'implict none (external)'.
* symbol.c (gfc_get_namespace): Don't set has_implicit_none_export
to parent namespace's setting.
PR fortran/93309
* gfortran.dg/external_implicit_none_2.f90: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/interface.c | 10 | ||||
-rw-r--r-- | gcc/fortran/symbol.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/external_implicit_none_2.f90 | 28 |
5 files changed, 50 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 3f412fd..8d963a5 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2020-01-21 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/93309 + * interface.c (gfc_procedure_use): Also check parent namespace for + 'implict none (external)'. + * symbol.c (gfc_get_namespace): Don't set has_implicit_none_export + to parent namespace's setting. + 2020-01-19 Thomas König <tkoenig@gcc.gnu.org> PR fortran/44960 diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index c4a6882..429abc7 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -3798,8 +3798,16 @@ gfc_procedure_use (gfc_symbol *sym, gfc_actual_arglist **ap, locus *where) explicitly declared at all if requested. */ if (sym->attr.if_source == IFSRC_UNKNOWN && !sym->attr.is_iso_c) { + bool has_implicit_none_export = false; implicit = true; - if (sym->ns->has_implicit_none_export && sym->attr.proc == PROC_UNKNOWN) + if (sym->attr.proc == PROC_UNKNOWN) + for (gfc_namespace *ns = sym->ns; ns; ns = ns->parent) + if (ns->has_implicit_none_export) + { + has_implicit_none_export = true; + break; + } + if (has_implicit_none_export) { const char *guessed = gfc_lookup_function_fuzzy (sym->name, sym->ns->sym_root); diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 526f6c4..47b7164 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2898,9 +2898,6 @@ gfc_get_namespace (gfc_namespace *parent, int parent_types) } } - if (parent_types && ns->parent != NULL) - ns->has_implicit_none_export = ns->parent->has_implicit_none_export; - ns->refs = 1; return ns; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6332af8..806e0b9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-01-21 Tobias Burnus <tobias@codesourcery.com> + + PR fortran/93309 + * gfortran.dg/external_implicit_none_2.f90: New. + 2020-01-21 Richard Biener <rguenther@suse.de> PR tree-optimization/92328 diff --git a/gcc/testsuite/gfortran.dg/external_implicit_none_2.f90 b/gcc/testsuite/gfortran.dg/external_implicit_none_2.f90 new file mode 100644 index 0000000..b2b1dd1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/external_implicit_none_2.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! +! PR fortran/93309 +! +module m + implicit none(external) +contains + subroutine s + implicit none(external) ! OK + end subroutine +end module + +module m2 + implicit none(external) +contains + subroutine s + call foo(1) ! { dg-error "not explicitly declared" } + end subroutine +end module + +module m3 + implicit none(external) +contains + subroutine s + implicit none(external) ! OK + implicit none(external) ! { dg-error "Duplicate IMPLICIT NONE statement" } + end subroutine +end module |