diff mbox

[Fortran,committed] Free loop and gfc_ss data

Message ID 50347487.2060102@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Aug. 22, 2012, 5:56 a.m. UTC
Committed as Rev. 190586 after successful regtesting.

That's the version I also had attached to 
http://gcc.gnu.org/ml/fortran/2012-08/msg00118.html; as written there:

"The patch is incomplete, e.g. "argss" of gfc_conv_procedure_call is not 
(or not always) freed. Ditto for rss of gfc_trans_assignment_1; ditto 
for lss and rss of gfc_trans_pointer_assignment."

Tobias

Comments

Mikael Morin Aug. 22, 2012, 9:38 a.m. UTC | #1
Hello,

On 22/08/2012 07:56, Tobias Burnus wrote:
> Committed as Rev. 190586 after successful regtesting.
> 
> That's the version I also had attached to
> http://gcc.gnu.org/ml/fortran/2012-08/msg00118.html; as written there:
I have one minor comment about it. See below.
> 
> "The patch is incomplete, e.g. "argss" of gfc_conv_procedure_call is not
> (or not always) freed. Ditto for rss of gfc_trans_assignment_1; 
From glancing at the code, I don't see why rss is not freed by
gfc_cleanup_loop for the latter.


> Index: gcc/fortran/trans-expr.c
> ===================================================================
> --- gcc/fortran/trans-expr.c	(Revision 190585)
> +++ gcc/fortran/trans-expr.c	(Arbeitskopie)
> @@ -6770,6 +6771,7 @@ gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_
>        if (!expr2->value.function.isym)
>  	{
>  	  realloc_lhs_loop_for_fcn_call (&se, &expr1->where, &ss, &loop);
> +	  gfc_cleanup_loop (&loop);
>  	  ss->is_alloc_lhs = 1;
>  	}
>        else
This takes care of freeing ss along the way, but ss should be freed
outside of the conditional too.

Mikael
diff mbox

Patch

Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 190585)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -533,6 +533,7 @@  gfc_copy_class_to_class (tree from, tree to, tree
       loop.to[0] = nelems;
       gfc_trans_scalarizing_loops (&loop, &loopbody);
       gfc_add_block_to_block (&body, &loop.pre);
+      gfc_cleanup_loop (&loop);
       tmp = gfc_finish_block (&body);
     }
   else
@@ -6770,6 +6771,7 @@  gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_
       if (!expr2->value.function.isym)
 	{
 	  realloc_lhs_loop_for_fcn_call (&se, &expr1->where, &ss, &loop);
+	  gfc_cleanup_loop (&loop);
 	  ss->is_alloc_lhs = 1;
 	}
       else
@@ -6778,6 +6780,7 @@  gfc_trans_arrayfunc_assign (gfc_expr * expr1, gfc_
 
   gfc_conv_function_expr (&se, expr2);
   gfc_add_block_to_block (&se.pre, &se.post);
+  gfc_free_ss (se.ss);
 
   return gfc_finish_block (&se.pre);
 }
Index: gcc/fortran/trans-intrinsic.c
===================================================================
--- gcc/fortran/trans-intrinsic.c	(Revision 190585)
+++ gcc/fortran/trans-intrinsic.c	(Arbeitskopie)
@@ -1328,6 +1328,7 @@  gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *exp
   argse.descriptor_only = 1;
 
   gfc_conv_expr_descriptor (&argse, expr->value.function.actual->expr, ss);
+  gfc_free_ss (ss);
   gfc_add_block_to_block (&se->pre, &argse.pre);
   gfc_add_block_to_block (&se->post, &argse.post);
 
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 190585)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,9 @@ 
+2012-08-22  Tobias Burnus  <burnus@net-b.de>
+
+	* trans-expr.c (gfc_copy_class_to_class,
+	gfc_trans_arrayfunc_assign): Free loop and ss data.
+	* trans-intrinsic.c (gfc_trans_arrayfunc_assign): Free ss data.
+
 2012-08-21  Tobias Burnus  <burnus@net-b.de>
 
 	* parse.c (parse_contained): Include EXEC_END_PROCEDURE