diff options
author | Harald Anlauf <anlauf@gmx.de> | 2025-03-26 22:04:39 +0100 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2025-03-26 22:52:37 +0100 |
commit | b70bd691cfd77b4d7a453031599bb6f1d48aedf1 (patch) | |
tree | 590d2274d9ec139d85853d15b486941fd2f12891 /gcc/fortran | |
parent | fc749717001436d49ed34aec6b034670f5a3fbcd (diff) | |
download | gcc-b70bd691cfd77b4d7a453031599bb6f1d48aedf1.zip gcc-b70bd691cfd77b4d7a453031599bb6f1d48aedf1.tar.gz gcc-b70bd691cfd77b4d7a453031599bb6f1d48aedf1.tar.bz2 |
Fortran: fix bogus recursion with DT default initialization [PR118796]
PR fortran/118796
gcc/fortran/ChangeLog:
* resolve.cc: Do not apply default initialization to a derived-type
function result if the resolved function is use-associated.
gcc/testsuite/ChangeLog:
* gfortran.dg/derived_result_4.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/resolve.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index cf9318f..cb36589 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -17946,7 +17946,8 @@ skip_interfaces: /* Mark the result symbol to be referenced, when it has allocatable components. */ sym->result->attr.referenced = 1; - else if (a->function && !a->pointer && !a->allocatable && sym->result) + else if (a->function && !a->pointer && !a->allocatable && !a->use_assoc + && sym->result) /* Default initialization for function results. */ apply_default_init (sym->result); } |