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]

Re: Unreviewed patch: -fdump-translation-unit fix (fixes PR c/9177)


On Thu, 17 Apr 2003, Zack Weinberg wrote:
>> I'm volunteering to apply it, if approved.  Okay mainline? 3.3?
> Yes.

Thanks!  I applied the following (with a slightly adjusted comment and
ChangeLog) to the 3.3 branch.

On mainline c-decl.c has changed a bit, and the patch at the end of this
message seems to be a direct adaption of the original one, but I'd like
to get your (Alexander, Zack) feedback to be sure.

Gerald


2003-04-18  Alexander Sotirov  <sluncho at mirizma dot org>

	PR c/9177
	* c-decl.c (c_expand_body): Don't garbage collect the function
	body if we are going to dump it later.

Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.356.2.7
diff -u -3 -p -r1.356.2.7 c-decl.c
--- c-decl.c	6 Apr 2003 03:15:19 -0000	1.356.2.7
+++ c-decl.c	18 Apr 2003 16:59:39 -0000
@@ -6537,7 +6537,9 @@ c_expand_body (fndecl, nested_p, can_def

   /* Generate the RTL for this function.  */
   expand_stmt (DECL_SAVED_TREE (fndecl));
-  if (uninlinable)
+
+  /* Keep the function body if it's needed for inlining or dumping.  */
+  if (uninlinable && !dump_enabled_p (TDI_all))
     {
       /* Allow the body of the function to be garbage collected.  */
       DECL_SAVED_TREE (fndecl) = NULL_TREE;


Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.381
diff -u -3 -p -r1.381 c-decl.c
--- c-decl.c	17 Apr 2003 21:27:29 -0000	1.381
+++ c-decl.c	18 Apr 2003 16:53:22 -0000
@@ -6244,7 +6244,8 @@ finish_function (nested, can_defer_p)

       c_expand_body (fndecl);

-      if (uninlinable)
+      /* Keep the function body if it's needed for inlining or dumping.  */
+      if (uninlinable && !dump_enabled_p (TDI_all))
 	{
 	  /* Allow the body of the function to be garbage collected.  */
 	  DECL_SAVED_TREE (fndecl) = NULL_TREE;


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