------- Comment #4 from pault at gcc dot gnu dot org 2009-07-22 07:13 ------- This fix bootstraps and regtests on x86_64/FC9. I will commit it as "obvious" tonight.
Paul Index: gcc/fortran/trans-decl.c =================================================================== --- gcc/fortran/trans-decl.c (revision 149846) +++ gcc/fortran/trans-decl.c (working copy) @@ -3693,19 +3693,20 @@ gfc_get_symbol_decl (sym); } - /* INTENT(out) dummy arguments with allocatable components are reset - by default and need to be set referenced to generate the code for - automatic lengths. */ - if (sym->attr.dummy && !sym->attr.referenced + /* INTENT(out) dummy arguments and result variables with allocatable + components are reset by default and need to be set referenced to + generate the code for nullification and automatic lengths. */ + if (!sym->attr.referenced && sym->ts.type == BT_DERIVED && sym->ts.derived->attr.alloc_comp - && sym->attr.intent == INTENT_OUT) + && ((sym->attr.dummy && sym->attr.intent == INTENT_OUT) + || + (sym->attr.result && sym != sym->result))) { sym->attr.referenced = 1; gfc_get_symbol_decl (sym); } - /* Check for dependencies in the array specification and string length, adding the necessary declarations to the function. We mark the symbol now, as well as in traverse_ns, to prevent -- pault at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- AssignedTo|unassigned at gcc dot gnu |pault at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2009-07-20 06:47:06 |2009-07-22 07:13:50 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40796