Again on gfortran for Mac OS-X
Paul Thomas
paulthomas2@wanadoo.fr
Sun Jan 6 08:57:00 GMT 2008
FX,
>>
> I just posted it as PR34681 - the problem arises because t.data is
> nullified one each entry to 'mah'.
>
This is one that Erik and I should have seen in the first place.
Derived types with allocatable components are excluded from the return
from gfc_trans_deferred_array when TREE_STATIC (desc) = 1. Clearly the
nullification on entry and exit needs to be suppressed in this case.
This fixes it:
Index: gcc/fortran/trans-array.c
===================================================================
*** gcc/fortran/trans-array.c (revision 131237)
--- gcc/fortran/trans-array.c (working copy)
*************** gfc_trans_deferred_array (gfc_symbol * s
*** 5527,5533 ****
}
/* NULLIFY the data pointer. */
! if (GFC_DESCRIPTOR_TYPE_P (type))
gfc_conv_descriptor_data_set (&fnblock, descriptor,
null_pointer_node);
gfc_add_expr_to_block (&fnblock, body);
--- 5527,5533 ----
}
/* NULLIFY the data pointer. */
! if (GFC_DESCRIPTOR_TYPE_P (type) && sym->attr.save != SAVE_EXPLICIT)
gfc_conv_descriptor_data_set (&fnblock, descriptor,
null_pointer_node);
gfc_add_expr_to_block (&fnblock, body);
*************** gfc_trans_deferred_array (gfc_symbol * s
*** 5545,5551 ****
gfc_add_expr_to_block (&fnblock, tmp);
}
! if (sym->attr.allocatable)
{
tmp = gfc_trans_dealloc_allocated (sym->backend_decl);
gfc_add_expr_to_block (&fnblock, tmp);
--- 5545,5551 ----
gfc_add_expr_to_block (&fnblock, tmp);
}
! if (sym->attr.allocatable && sym->attr.save != SAVE_EXPLICIT)
{
tmp = gfc_trans_dealloc_allocated (sym->backend_decl);
gfc_add_expr_to_block (&fnblock, tmp);
I'll commit it as obvious tomorrow night, together with testcase and
ChangeLog.
Cheers
Paul
More information about the Fortran
mailing list