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
2012-12-05 Tobias Burnus <bur...@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. */