diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2021-04-20 07:30:07 +0100 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2021-04-20 07:30:45 +0100 |
commit | 67378cd63d62bf0c69e966d1d202a1e586550a68 (patch) | |
tree | 28e3fc924f7c7bb8db0a96db889e094a225c5f9d /gcc/fortran/trans-decl.c | |
parent | 30b11d8d1be9c683f1517472c47a3cb69df02c4f (diff) | |
download | gcc-67378cd63d62bf0c69e966d1d202a1e586550a68.zip gcc-67378cd63d62bf0c69e966d1d202a1e586550a68.tar.gz gcc-67378cd63d62bf0c69e966d1d202a1e586550a68.tar.bz2 |
Fortran: Fix host associated PDT entity initialization [PR99307].
2021-04-20 Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/100110
* trans-decl.c (gfc_get_symbol_decl): Replace test for host
association with a check that the current and symbol namespaces
are the same.
gcc/testsuite/
PR fortran/100110
* gfortran.dg/pdt_31.f03: New test.
* gfortran.dg/pdt_26.f03: Reduce 'builtin_malloc' count from 9
to 8.
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r-- | gcc/fortran/trans-decl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 34a0d49..cc9d855 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -1548,7 +1548,8 @@ gfc_get_symbol_decl (gfc_symbol * sym) declaration of the entity and memory allocated/deallocated. */ if ((sym->ts.type == BT_DERIVED || sym->ts.type == BT_CLASS) && sym->param_list != NULL - && !(sym->attr.host_assoc || sym->attr.use_assoc || sym->attr.dummy)) + && gfc_current_ns == sym->ns + && !(sym->attr.use_assoc || sym->attr.dummy)) gfc_defer_symbol_init (sym); /* Dummy PDT 'len' parameters should be checked when they are explicit. */ |