diff mbox

[Fortran] Small patch for calls to gfc_deallocate_scalar_with_status

Message ID 50BF7120.6040806@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Dec. 5, 2012, 4:06 p.m. UTC
First, I would like to *ping* the patch 
http://gcc.gnu.org/ml/fortran/2012-12/msg00022.html


The patch below is part of my FINAL patch. The NULL -> NULL_TREE change 
is obvious. The expr to al->expr change is to pass a BT_CLASS instead of 
a BT_DERIVED. And the NULL to gfc_lval_expr_from_sym change allows to 
access var->_vtab->_final for a BT_CLASS deferred variable.

Build and regtested on x86-64-linux.
OK for the trunk?

Tobias

Comments

Janus Weil Dec. 8, 2012, 5:02 p.m. UTC | #1
Hi Tobias,

> The patch below is part of my FINAL patch. The NULL -> NULL_TREE change is
> obvious.

certainly ok.


> The expr to al->expr change is to pass a BT_CLASS instead of a
> BT_DERIVED. And the NULL to gfc_lval_expr_from_sym change allows to access
> var->_vtab->_final for a BT_CLASS deferred variable.

It seems that both of them will not have any effect right now, but are
useful only as preparation for FINAL, right?


> Build and regtested on x86-64-linux.
> OK for the trunk?

Yes, ok from my side. One could also commit those changes together
with the actual changes that will come in
gfc_deallocate_scalar_with_status. OTOH, they are not doing any harm,
so: Ok for trunk.

Thanks for the patch,
Janus
Janus Weil Dec. 8, 2012, 5:04 p.m. UTC | #2
Btw, one nit about your ChangeLog:

2012-12-05  Tobias Burnus  <burnus@net-b.de>

    * trans-array.c (gfc_deallocate_scalar_with_status): Use
    NULL_TREE in the call to gfc_deallocate_scalar_with_status.
    * trans-decl.c (gfc_trans_deferred_vars): Pass symbol.
    * trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable.


The trans-array.c line should have "structure_alloc_comps".

Cheers,
Janus



2012/12/5 Tobias Burnus <burnus@net-b.de>:
> First, I would like to *ping* the patch
> http://gcc.gnu.org/ml/fortran/2012-12/msg00022.html
>
>
> The patch below is part of my FINAL patch. The NULL -> NULL_TREE change is
> obvious. The expr to al->expr change is to pass a BT_CLASS instead of a
> BT_DERIVED. And the NULL to gfc_lval_expr_from_sym change allows to access
> var->_vtab->_final for a BT_CLASS deferred variable.
>
> Build and regtested on x86-64-linux.
> OK for the trunk?
>
> Tobias
diff mbox

Patch

2012-12-05  Tobias Burnus  <burnus@net-b.de>

	* trans-array.c (gfc_deallocate_scalar_with_status): Use
	NULL_TREE in the call to gfc_deallocate_scalar_with_status.
	* trans-decl.c (gfc_trans_deferred_vars): Pass symbol.
	* trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable.

diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 24adfde..0689892 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -7589,7 +7589,7 @@  structure_alloc_comps (gfc_symbol * der_type, tree decl,
 					CLASS_DATA (c)->attr.codimension);
 	      else
 		{
-		  tmp = gfc_deallocate_scalar_with_status (comp, NULL, true, NULL,
+		  tmp = gfc_deallocate_scalar_with_status (comp, NULL_TREE, true, NULL,
 							   CLASS_DATA (c)->ts);
 		  gfc_add_expr_to_block (&tmpblock, tmp);
 		  called_dealloc_with_status = true;
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 3bee178..b236050 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -3780,9 +3780,10 @@  gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
 						      NULL_TREE, true, NULL,
 						      true);
 		  else
-		    tmp = gfc_deallocate_scalar_with_status (se.expr, NULL,
-							     true, NULL,
-							     sym->ts);
+		    tmp = gfc_deallocate_scalar_with_status (se.expr, NULL_TREE,
+						   true,
+						   gfc_lval_expr_from_sym (sym),
+						   sym->ts);
 		}
 	      if (sym->ts.type == BT_CLASS)
 		{
diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index 79dc27d..6fe8b77 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -5380,7 +5380,7 @@  gfc_trans_deallocate (gfc_code *code)
       else
 	{
 	  tmp = gfc_deallocate_scalar_with_status (se.expr, pstat, false,
-						   expr, expr->ts);
+						   al->expr, al->expr->ts);
 	  gfc_add_expr_to_block (&se.pre, tmp);
 
 	  /* Set to zero after deallocation.  */