From: Paul Thomas Date: Wed, 22 Jul 2009 18:12:35 +0000 (+0000) Subject: [multiple changes] X-Git-Tag: releases/gcc-4.5.0~4437 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5af2eacecc039b5eb83469f500fe63de71aed74f;p=thirdparty%2Fgcc.git [multiple changes] 2009-07-22 Paul Thomas PR fortran/40796 * trans-decl.c (generate_local_decl): Unreferenced result variables with allocatable components should be treated like INTENT_OUT dummy variables. 2009-07-21 Richard Guenther PR fortran/40726 Change attribution to Richi. From-SVN: r149952 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9370dd7227bd..0cdf188527a2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2009-07-22 Paul Thomas + + PR fortran/40796 + * trans-decl.c (generate_local_decl): Unreferenced result + variables with allocatable components should be treated like + INTENT_OUT dummy variables. + 2009-07-22 Francois-Xavier Coudert * trans.h (gfc_set_decl_assembler_name): New prototype. @@ -8,7 +15,7 @@ * trans-common.c (build_common_decl): Use gfc_set_decl_assembler_name instead of SET_DECL_ASSEMBLER_NAME. -2009-07-21 Paul Thomas +2009-07-21 Richard Guenther PR fortran/40726 * trans-decl.c (gfc_get_extern_function_decl): Do not set diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 83c28cd8ebe7..b70d0bd235eb 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3702,19 +3702,20 @@ generate_local_decl (gfc_symbol * sym) 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