aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-decl.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2009-07-22 18:12:35 +0000
committerPaul Thomas <pault@gcc.gnu.org>2009-07-22 18:12:35 +0000
commit5af2eacecc039b5eb83469f500fe63de71aed74f (patch)
treecebb6b4ee23a448c5442969b7a027f7ac44bd887 /gcc/fortran/trans-decl.c
parent61ed639283acd896af48d40727b01f5d516008cf (diff)
downloadgcc-5af2eacecc039b5eb83469f500fe63de71aed74f.zip
gcc-5af2eacecc039b5eb83469f500fe63de71aed74f.tar.gz
gcc-5af2eacecc039b5eb83469f500fe63de71aed74f.tar.bz2
[multiple changes]
2009-07-22 Paul Thomas <pault@gcc.gnu.org> 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 <rguenther@suse.de> PR fortran/40726 Change attribution to Richi. From-SVN: r149952
Diffstat (limited to 'gcc/fortran/trans-decl.c')
-rw-r--r--gcc/fortran/trans-decl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 83c28cd8e..b70d0bd 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