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]

[C++ PATCH] Fix gty leak


Hi,
in fixing the abi problem, garbage collection blew up. Fixed
thusly.

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2002-08-02  Nathan Sidwell  <nathan@codesourcery.com>

	* tree.c (build_shared_int_cst): Make cache file scope, and
	GTY it.

Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.290
diff -c -3 -p -r1.290 tree.c
*** cp/tree.c	24 Jul 2002 23:01:07 -0000	1.290
--- cp/tree.c	2 Aug 2002 17:08:09 -0000
*************** build_min VPARAMS ((enum tree_code code,
*** 1505,1523 ****
     same node; therefore, callers should never modify the node
     returned.  */
  
  tree
  build_shared_int_cst (i)
       int i;
  {
-   static tree cache[256];
- 
    if (i >= 256)
      return build_int_2 (i, 0);
    
!   if (!cache[i])
!     cache[i] = build_int_2 (i, 0);
    
!   return cache[i];
  }
  
  tree
--- 1505,1523 ----
     same node; therefore, callers should never modify the node
     returned.  */
  
+ static GTY(()) tree shared_int_cache[256];
+ 
  tree
  build_shared_int_cst (i)
       int i;
  {
    if (i >= 256)
      return build_int_2 (i, 0);
    
!   if (!shared_int_cache[i])
!     shared_int_cache[i] = build_int_2 (i, 0);
    
!   return shared_int_cache[i];
  }
  
  tree

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