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]

[PATCH] Fix PR40005


The Fortan frontend is agnostic of our GC so we better communicate that
to the cgraph when registering new functions.

Also the frontend at the moment queues up all array descriptor types
(of which there are a multitude appearantly due to lang-specific data
attached to it) in the type variant chain - which leads to enormeous
recursion depth during GC walks.  An easy fix is to not use variants
but distinct copies and fix up the type compatibility via TYPE_CANONICAL.
To preserve the single debug representation for array descriptors we
can simply re-use the type-decl for the master copy.

Bootstrap and regtest running on x86_64-unknown-linux-gnu, ok for trunk?

Thanks,
Richard.

2009-07-25  Richard Guenther  <rguenther@suse.de>

	* trans-types.c (): Use build_distinct_type_copy with a
	proper TYPE_CANONICAL and re-use the type-decl of the
	original type.
	* trans-decl.c (): Signal cgraph we may not garbage collect.
	(): Likewise.
	(): Likewise.

Index: gcc/fortran/trans-types.c
===================================================================
--- gcc/fortran/trans-types.c	(revision 149846)
+++ gcc/fortran/trans-types.c	(working copy)
@@ -1602,7 +1602,9 @@
   int n;
 
   base_type = gfc_get_array_descriptor_base (dimen);
-  fat_type = build_variant_type_copy (base_type);
+  fat_type = build_distinct_type_copy (base_type);
+  TYPE_CANONICAL (fat_type) = base_type;
+  TYPE_STUB_DECL (fat_type) = TYPE_STUB_DECL (base_type);
 
   tmp = TYPE_NAME (etype);
   if (tmp && TREE_CODE (tmp) == TYPE_DECL)
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(revision 149846)
+++ gcc/fortran/trans-decl.c	(working copy)
@@ -2023,7 +2023,7 @@
 
       current_function_decl = NULL_TREE;
 
-      cgraph_finalize_function (thunk_fndecl, false);
+      cgraph_finalize_function (thunk_fndecl, true);
 
       /* We share the symbols in the formal argument list with other entry
 	 points and the master function.  Clear them so that they are
@@ -4104,7 +4104,7 @@
   /* Output the GENERIC tree.  */
   dump_function (TDI_original, ftn_main);
 
-  cgraph_finalize_function (ftn_main, false);
+  cgraph_finalize_function (ftn_main, true);
 
   if (old_context)
     {
@@ -4375,7 +4375,7 @@
        added to our parent's nested function list.  */
     (void) cgraph_node (fndecl);
   else
-    cgraph_finalize_function (fndecl, false);
+    cgraph_finalize_function (fndecl, true);
 
   gfc_trans_use_stmts (ns);
   gfc_traverse_ns (ns, gfc_emit_parameter_debug_info);


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