https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125428
Christopher Albert <albert at tugraz dot at> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |albert at tugraz dot at,
| |jvdelisle at gcc dot gnu.org
--- Comment #4 from Christopher Albert <albert at tugraz dot at> ---
Open for review, comments welcome:
https://github.com/lazy-fortran/gcc/pull/42
Root cause: for a scalar derived-type assignment,
gfc_trans_assignment_1 converted the lhs expression a second time for
finalization and for the scalar allocation guard. That repeated
conversion could omit prerequisite statements for component
temporaries, so the finalizer or the reallocation path saw
uninitialized state. The fix threads the already stabilized lhs into
the finalization call, its allocation guard, and
alloc_scalar_allocatable_for_assignment instead of regenerating it.
Includes a run test. check-fortran and the libgomp Fortran suite are
clean; the finalize_62.f90 test from fork PR 38 still passes.