https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123071
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Paul Thomas <[email protected]>: https://gcc.gnu.org/g:b1f99a0d8c4188651a9a32c141896f69cc5a1f98 commit r16-6563-gb1f99a0d8c4188651a9a32c141896f69cc5a1f98 Author: Paul Thomas <[email protected]> Date: Wed Jan 7 16:14:12 2026 +0000 Fortran: [PDT]Fix ICE in tree check and memory leaks[PR90218, PR123071] 2026-01-07 Paul Thomas <[email protected]> gcc/fortran PR fortran/123071 * resolve.cc (resolve_typebound_function): If a generic typebound procedure is marked as overridable and all the specific procedures are non-overridable, it is safe to resolve the compcall. PR fortran/90218 * trans-array.cc (gfc_trans_array_constructor_value): PDT structure constructor elements must be finalized. (trans_array_constructor): Set 'finalize_required' for PDT constructors. * trans-decl.cc (gfc_get_symbol_decl): PDT initialization is required in contained namespaces as long as the parent is not a module. (gfc_init_default_pdt): Delete the stmtblock_t argument. Assign a variable 'value' expression using gfc_trans_assignment. Simplifiy the logic around the call to gfc_init_default_dt. In both cases return a tree expression or null tree. (gfc_trans_deferred_vars): Only call gfc_allocate_pdt_comp if gfc_init_default_pdt returns null tree. * trans-expr.cc (gfc_trans_alloc_subarray_assign): Add a static stmtblock_t pointer 'final_block'. Free 'dest' data pointer and add to final_block. (gfc_conv_structure): Set 'final_block' to the se's finalblock. (gfc_trans_assignment_1): Do not deallocate PDT array ctrs. trans-stmt.cc (gfc_trans_allocate): Also deallocate PDT expr3 allocatable components. (gfc_trans_deallocate): Add PDT deallocation to se.pre instead of block. * trans-stmt.cc (gfc_trans_allocate): Free the allocatable components of a PDT expr3. (gfc_trans_deallocate): Add 'tmp' to se.pre rather than block. gcc/testsuite/ PR fortran/90218 * gfortran.dg/pdt_79.f03: Used uninitialized warning and change tree scan for 'mapped_tensor.j' to 'Pdttensor_t_4.2.j'. * gfortran.dg/pdt_80.f03: New test.
