------- Comment #1 from janus at gcc dot gnu dot org 2010-05-15 20:43 ------- Here is the fix:
Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 159433) +++ gcc/fortran/trans-decl.c (working copy) @@ -3259,8 +3259,6 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tr if (sym_has_alloc_comp && !seen_trans_deferred_array) fnbody = gfc_trans_deferred_array (sym, fnbody); } - else if (sym_has_alloc_comp) - fnbody = gfc_trans_deferred_array (sym, fnbody); else if (sym->attr.allocatable || (sym->ts.type == BT_CLASS && sym->ts.u.derived->components->attr.allocatable)) @@ -3298,6 +3296,8 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, tr fnbody = gfc_finish_block (&block); } } + else if (sym_has_alloc_comp) + fnbody = gfc_trans_deferred_array (sym, fnbody); else if (sym->ts.type == BT_CHARACTER) { gfc_get_backend_locus (&loc); The problem was simply that the branches in the if statement were in the wrong order, so that nullification of an allocatable scalar was missed if it had allocatable components. -- janus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2010-05-15 20:43:55 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44154