https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96495
--- Comment #5 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:e86a02f87d8a11480c1421ef2dd71b8b5f43d938 commit r11-3430-ge86a02f87d8a11480c1421ef2dd71b8b5f43d938 Author: Paul Thomas <pa...@gcc.gnu.org> Date: Thu Sep 24 11:52:30 2020 +0100 This patch fixes PR96495 - frees result components outside loop. 2020-24-09 Paul Thomas <pa...@gcc.gnu.org> gcc/fortran PR fortran/96495 * trans-expr.c (gfc_conv_procedure_call): Take the deallocation of allocatable result components of a scalar result outside the scalarization loop. Find and use the stored result. gcc/testsuite/ PR fortran/96495 * gfortran.dg/alloc_comp_result_2.f90 : New test.