This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]