gnu/gcc/d9a9628046f7c1e70d56c082e3f2cec034415298 Fortran: Fix ex-module inherited PDT parameter namespaces [PR104750]
2026-09-03 Amir Shahmoradi <shahmoradi@lanl.gov>
Paul Thomas <pault@gcc.gnu.org>
gcc/fortran
PR fortran/104750
* module.cc (mio_full_f2k_derived) : Instead of transferring
the sym_root from the formal namespace, call mio_f2k_derived so
that all required symbols and references are fully loaded.
(read_cleanup): Restore named symtree entries for referenced
PDT type specification parameters during module cleanup, while
preserving existing handling for ordinary hidden symbols and
ignoring formal parameters without namespaces.
(fixup_pdt_parameter_namespaces): A new function that transfers
the namespace of locally declared PDT type specification parms
to the derived-type namespace after skipping inherited parameters,
preserving the existing namespace ownership and ref counting.
(read_module): Call the new fcn after read_cleanup, so that the
required symbol and formal-parameter information has been fully
reconstructed first.
gcc/testsuite
PR fortran/104750
* gfortran.dg/pdt_93.f90: New test.
2 files changed