https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104272
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Paul Thomas <pa...@gcc.gnu.org>: https://gcc.gnu.org/g:b0e85485fbf042abccee5c0a9eb499da386c8db3 commit r13-7181-gb0e85485fbf042abccee5c0a9eb499da386c8db3 Author: Paul Thomas <pa...@gcc.gnu.org> Date: Fri Apr 14 11:14:00 2023 +0100 Fortran: Fix an excess finalization during allocation [PR104272] 2023-04-14 Paul Thomas <pa...@gcc.gnu.org> gcc/fortran PR fortran/104272 * gfortran.h : Add expr3_not_explicit bit field to gfc_code. * resolve.cc (resolve_allocate_expr): Set bit field when the default initializer is applied to expr3. * trans-stmt.cc (gfc_trans_allocate): If expr3_not_explicit is set, do not deallocate expr3. gcc/testsuite/ PR fortran/104272 * gfortran.dg/class_result_8.f90 : Number of builtin_frees down from 6 to 5 without memory leaks. * gfortran.dg/finalize_52.f90: New test