This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix gty leak
- From: Nathan Sidwell <nathan at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 02 Aug 2002 18:16:46 +0100
- Subject: [C++ PATCH] Fix gty leak
- Organization: Codesourcery LLC
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