diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2017-10-13 18:59:34 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2017-10-13 18:59:34 +0000 |
commit | e6110fa622ff495f5a8d492fcad4cdab5259de0f (patch) | |
tree | 51a55bcddf372a34e18e9f42a421cf2ce2dca2cf /gcc/fortran/resolve.c | |
parent | d7327979fe8bcfdee1a3bfa77068072dc6073991 (diff) | |
download | gcc-e6110fa622ff495f5a8d492fcad4cdab5259de0f.zip gcc-e6110fa622ff495f5a8d492fcad4cdab5259de0f.tar.gz gcc-e6110fa622ff495f5a8d492fcad4cdab5259de0f.tar.bz2 |
re PR fortran/81048 (incorrect derived type initialization)
2017-10-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/81048
* resolve.c (resolve_symbol): Ensure that derived type array
results get default initialization.
2017-10-13 Paul Thomas <pault@gcc.gnu.org>
PR fortran/81048
* gfortran.dg/derived_init_4.f90 : New test.
From-SVN: r253738
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index bd31634..5e4988e 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -14967,7 +14967,12 @@ resolve_symbol (gfc_symbol *sym) if ((!a->save && !a->dummy && !a->pointer && !a->in_common && !a->use_assoc - && !a->result && !a->function) + && a->referenced + && !((a->function || a->result) + && (!a->dimension + || sym->ts.u.derived->attr.alloc_comp + || sym->ts.u.derived->attr.pointer_comp)) + && !(a->function && sym != sym->result)) || (a->dummy && a->intent == INTENT_OUT && !a->pointer)) apply_default_init (sym); else if (a->function && sym->result && a->access != ACCESS_PRIVATE |