This patch fixes PR96495 - frees result components outside loop.
authorPaul Thomas <pault@gcc.gnu.org>
Thu, 24 Sep 2020 10:52:30 +0000 (11:52 +0100)
committerPaul Thomas <pault@gcc.gnu.org>
Thu, 24 Sep 2020 10:52:30 +0000 (11:52 +0100)
commite86a02f87d8a11480c1421ef2dd71b8b5f43d938
tree87dd382f6a75e535a9fc6570dc85b3dc74b2d83a
parentfe28d34079aad7d3bf8d9bfd78d0ba43110b7906
This patch fixes PR96495 - frees result components outside loop.

2020-24-09  Paul Thomas  <pault@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.
gcc/fortran/trans-expr.c
gcc/testsuite/gfortran.dg/alloc_comp_result_2.f90