This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
fix gc bug in java_expand_classes
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Subject: fix gc bug in java_expand_classes
- From: Per Bothner <per at bothner dot com>
- Date: 27 Apr 2001 12:21:32 -0700
I've checked this patch into the trunk and the branch. This fixes a gc
bug that was triggered by compiling Jigsaw. (By the way: I have now
successfully compiled and linked jigsaw - but it crashes reading properties.)
2001-04-27 Per Bothner <per@bothner.com>
* parse.y (java_expand_classes): Don't change ctxp_for_generation
while iterating, since that could cause gc to lose stuff.
Index: parse.y
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.251.2.19
diff -u -p -r1.251.2.19 parse.y
--- parse.y 2001/04/26 19:43:48 1.251.2.19
+++ parse.y 2001/04/27 19:13:55
@@ -8641,7 +8641,7 @@ void
java_expand_classes ()
{
int save_error_count = 0;
- static struct parser_ctxt *saved_ctxp = NULL;
+ static struct parser_ctxt *cur_ctxp = NULL;
java_parse_abort_on_error ();
if (!(ctxp = ctxp_for_generation))
@@ -8649,10 +8649,10 @@ java_expand_classes ()
java_layout_classes ();
java_parse_abort_on_error ();
- saved_ctxp = ctxp_for_generation;
- for (; ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
+ cur_ctxp = ctxp_for_generation;
+ for (; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
- ctxp = ctxp_for_generation;
+ ctxp = cur_ctxp;
input_filename = ctxp->filename;
lang_init_source (2); /* Error msgs have method prototypes */
java_complete_expand_classes (); /* Complete and expand classes */
@@ -8662,11 +8662,10 @@ java_expand_classes ()
/* Find anonymous classes and expand their constructor, now they
have been fixed. */
- for (ctxp_for_generation = saved_ctxp;
- ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
tree current;
- ctxp = ctxp_for_generation;
+ ctxp = cur_ctxp;
for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
{
current_class = TREE_TYPE (current);
@@ -8696,11 +8695,10 @@ java_expand_classes ()
return;
/* Now things are stable, go for generation of the class data. */
- for (ctxp_for_generation = saved_ctxp;
- ctxp_for_generation; ctxp_for_generation = ctxp_for_generation->next)
+ for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
{
tree current;
- ctxp = ctxp_for_generation;
+ ctxp = cur_ctxp;
for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
{
current_class = TREE_TYPE (current);
--
--Per Bothner
per@bothner.com http://www.bothner.com/~per/