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]

Fix tiny memory leak and missing warning in mainline


Hi,
while working on other patch I noticed that we don't produce -Winline
warning when we decide to not inline at all into function and spotted
small memory leak.
bootstrapped/regtested i686 and commited.

2004-01-02  Jan Hubicka  <jh@suse.cz>
	* cgraphunit.c (cgraph_optimize_function):  Cann optimize_inline_calls
	when there is nothing to inline but warnings are requested.
	(cgraph_decide_inlining):  Fix memory leak.
Index: cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 cgraphunit.c
*** cgraphunit.c	1 Jan 2004 13:58:57 -0000	1.40
--- cgraphunit.c	2 Jan 2004 18:03:34 -0000
*************** cgraph_optimize_function (struct cgraph_
*** 476,482 ****
        struct cgraph_edge *e;
  
        for (e = node->callees; e; e = e->next_callee)
! 	if (e->inline_call)
  	  break;
        if (e)
          optimize_inline_calls (decl);
--- 476,482 ----
        struct cgraph_edge *e;
  
        for (e = node->callees; e; e = e->next_callee)
! 	if (e->inline_call || warn_inline)
  	  break;
        if (e)
          optimize_inline_calls (decl);
*************** cgraph_decide_inlining (void)
*** 1213,1229 ****
  		}
  	    }
  	}
- 
-       if (cgraph_dump_file)
- 	fprintf (cgraph_dump_file,
- 		 "\nInlined %i calls, eliminated %i functions, "
- 		 "%i insns turned to %i insns.\n\n",
- 		 ncalls_inlined, nfunctions_inlined, initial_insns,
- 		 overall_insns);
-       free (order);
-       free (inlined);
-       free (inlined_callees);
      }
  }
  
  /* Decide on the inlining.  We do so in the topological order to avoid
--- 1213,1229 ----
  		}
  	    }
  	}
      }
+ 
+   if (cgraph_dump_file)
+     fprintf (cgraph_dump_file,
+ 	     "\nInlined %i calls, eliminated %i functions, "
+ 	     "%i insns turned to %i insns.\n\n",
+ 	     ncalls_inlined, nfunctions_inlined, initial_insns,
+ 	     overall_insns);
+   free (order);
+   free (inlined);
+   free (inlined_callees);
  }
  
  /* Decide on the inlining.  We do so in the topological order to avoid


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