------- Comment #28 from pault at gcc dot gnu dot org 2006-09-29 15:00 ------- Created an attachment (id=12354) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12354&action=view) Patch that fixes Salvatore's latest
This patch moves the addition of EXPR_NULL for allocatable components to expr.c(gfc_default_initializer). The consequence of this is that ALL structures with allocatable components get a default initializer, even if it only contains EXPR_NULL. Whilst this is OK for the static initialization, it is unnecessary because of the nullification that is done upon coming into scope. Thus, translation of such intitializer expressions is skipped in trans-expr.c(gfc_conv_structure). ALLOCATE now does an assignment of this potentially compound default initializer expression to each and every allocatable component. Being a variable assignment, this produces extra code that checks for non-NULL data fields to see if they should be deallocated. This ups the dealloactions counted by alloc_comp_basics_1.f90 to 38. With this modification, the patch regtests OK. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20541