Commit 459e77b8 by Paul Thomas

re PR fortran/83567 (Parametrized derived types: Segmentation fault when…

re PR fortran/83567 (Parametrized derived types: Segmentation fault when assigning a function return value)

2017-12-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83567
	* trans-expr.c (gfc_trans_assignment_1): Free parameterized
	components of the lhs if dealloc is set.
	*trans-decl.c (gfc_trans_deferred_vars): Do not free the
	parameterized components of function results on leaving scope.


2017-12-28  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/83567
	* gfortran.dg/pdt_26.f90 : New test.

From-SVN: r256033
parent ec3131c5
...@@ -10078,7 +10078,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, ...@@ -10078,7 +10078,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
} }
/* Deallocate the lhs parameterized components if required. */ /* Deallocate the lhs parameterized components if required. */
if (dealloc && expr2->expr_type == EXPR_FUNCTION) if (dealloc && expr2->expr_type == EXPR_FUNCTION
&& !expr1->symtree->n.sym->attr.associate_var)
{ {
if (expr1->ts.type == BT_DERIVED if (expr1->ts.type == BT_DERIVED
&& expr1->ts.u.derived && expr1->ts.u.derived
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment