This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Result variables
- From: Paul Brook <paul at nowt dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Cc: "gcc-g95 List" <gcc-g95-devel at lists dot sourceforge dot net>
- Date: Fri, 15 Aug 2003 22:32:30 +0100
- Subject: [gfortran] Result variables
The attached patch fixes a bug whereby variables to hold function return
values would be added to the parent scope.
Applied to tree-ssa branch.
Paul
2003-08-15 Paul Brook <paul@nowt.org>
* trans-decl.c (gfc_build_qualified_array): Don't add symbols for
return values to parent scope.
(gfc_build_dummy_array_decl): Ditto.
diff -urpxCVS clean/tree-ssa/gcc/fortran/trans-decl.c gcc/gcc/fortran/trans-decl.c
--- clean/tree-ssa/gcc/fortran/trans-decl.c 2003-08-10 21:40:54.000000000 +0100
+++ gcc/gcc/fortran/trans-decl.c 2003-08-15 22:23:36.000000000 +0100
@@ -491,8 +491,9 @@ gfc_build_qualified_array (tree decl, gf
if (GFC_DESCRIPTOR_TYPE_P (type))
return;
- nest = (sym->ns->proc_name->backend_decl != current_function_decl);
assert (GFC_ARRAY_TYPE_P (type));
+ nest = (sym->ns->proc_name->backend_decl != current_function_decl)
+ && !sym->attr.contained;
for (dim = 0; dim < GFC_TYPE_ARRAY_RANK (type); dim++)
{
@@ -610,7 +611,8 @@ gfc_build_dummy_array_decl (gfc_symbol *
GFC_DECL_SAVED_DESCRIPTOR (decl) = dummy;
GFC_DECL_STRING (decl) = GFC_DECL_STRING (dummy);
- if (sym->ns->proc_name->backend_decl == current_function_decl)
+ if (sym->ns->proc_name->backend_decl == current_function_decl
+ || sym->attr.contained)
gfc_add_decl_to_function (decl);
else
gfc_add_decl_to_parent_function (decl);