This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Bootstrap failure on irix6.5 possibly caused by new C++ parser?
Kaveh R. Ghazi wrote:
> From: Mark Mitchell <mark@codesourcery.com>
> >
> > I'm already testing a patch which looks to fix the problem. It's past the
> > last point of failure and going well.
>
> Cool. Care to send it along, and I'll review it for you?
Me too, I'd like to see if it fixes the irix65 problem I have.
--
Kaveh R. Ghazi ghazi@caip.rutgers.edu
Ok attached is rough patch for cp/parser.c without changelog because I'm
still treg testing here, It does fix the powerpc-eabi abort.
The patch works by storing the access_checks and declarator_access_checks
on a TREE_LIST for the duration of their active scope. I'm using a TREE_LIST
because assuming that the corresponding routines are recusive, otherwise I
could just make these global statics with GTY marker.
Cheers
Graham
Index: parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.10
diff -c -p -r1.10 parser.c
*** parser.c 31 Dec 2002 20:28:27 -0000 1.10
--- parser.c 31 Dec 2002 20:58:03 -0000
*************** typedef struct cp_parser_context GTY (()
*** 1189,1194 ****
--- 1189,1199 ----
struct cp_parser_context *next;
} cp_parser_context;
+ /* ???? */
+ static GTY(()) tree declarator_access_checks_lists;
+
+ static GTY(()) tree access_checks_lists;
+
/* Prototypes. */
/* Constructors and destructors. */
*************** cp_parser_simple_declaration (parser, fu
*** 6697,6702 ****
--- 6702,6710 ----
/* We no longer need to defer access checks. */
access_checks = cp_parser_stop_deferring_access_checks (parser);
+ access_checks_lists = chainon (access_checks_lists,
+ build_tree_list (NULL_TREE, access_checks));
+
/* Keep going until we hit the `;' at the end of the simple
declaration. */
saw_declarator = false;
*************** cp_parser_simple_declaration (parser, fu
*** 6726,6732 ****
error ("mixing declarations and function-definitions is forbidden");
/* Otherwise, we're done with the list of declarators. */
else
! return;
}
/* The next token should be either a `,' or a `;'. */
token = cp_lexer_peek_token (parser->lexer);
--- 6734,6743 ----
error ("mixing declarations and function-definitions is forbidden");
/* Otherwise, we're done with the list of declarators. */
else
! {
! access_checks_lists = TREE_CHAIN (access_checks_lists);
! return;
! }
}
/* The next token should be either a `,' or a `;'. */
token = cp_lexer_peek_token (parser->lexer);
*************** cp_parser_simple_declaration (parser, fu
*** 6742,6747 ****
--- 6753,6759 ----
cp_parser_error (parser, "expected `,' or `;'");
/* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser);
+ access_checks_lists = TREE_CHAIN (access_checks_lists);
return;
}
/* After the first time around, a function-definition is not
*************** cp_parser_simple_declaration (parser, fu
*** 6770,6775 ****
--- 6782,6788 ----
/* Mark all the classes that appeared in the decl-specifier-seq as
having received a `;'. */
note_list_got_semicolon (decl_specifiers);
+ access_checks_lists = TREE_CHAIN (access_checks_lists);
}
/* Parse a decl-specifier-seq.
*************** cp_parser_init_declarator (parser,
*** 9642,9651 ****
declarator_access_checks
= cp_parser_stop_deferring_access_checks (parser);
/* If the DECLARATOR was erroneous, there's no need to go
further. */
if (declarator == error_mark_node)
! return error_mark_node;
/* Figure out what scope the entity declared by the DECLARATOR is
located in. `grokdeclarator' sometimes changes the scope, so
--- 9655,9673 ----
declarator_access_checks
= cp_parser_stop_deferring_access_checks (parser);
+ /* Prevent the declarator_access_checks from being reclaimed by the GC. */
+ declarator_access_checks_lists = chainon (declarator_access_checks_lists,
+ build_tree_list (NULL_TREE,
+ declarator_access_checks));
+
+
/* If the DECLARATOR was erroneous, there's no need to go
further. */
if (declarator == error_mark_node)
! {
! declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
! return error_mark_node;
! }
/* Figure out what scope the entity declared by the DECLARATOR is
located in. `grokdeclarator' sometimes changes the scope, so
*************** cp_parser_init_declarator (parser,
*** 9679,9684 ****
--- 9701,9707 ----
error message. */
cp_parser_error (parser,
"a function-definition is not allowed here");
+ declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
return error_mark_node;
}
else
*************** cp_parser_init_declarator (parser,
*** 9708,9713 ****
--- 9731,9739 ----
/* Pull the access-checks apart again. */
*ac = NULL_TREE;
+ /* We are finished with the elaboration list it can now be discarded. */
+ declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
+
return decl;
}
}
*************** cp_parser_init_declarator (parser,
*** 9724,9729 ****
--- 9750,9756 ----
{
cp_parser_error (parser,
"expected constructor, destructor, or type conversion");
+ declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
return error_mark_node;
}
*************** cp_parser_init_declarator (parser,
*** 9737,9742 ****
--- 9764,9770 ----
&& token->type != CPP_SEMICOLON)
{
cp_parser_error (parser, "expected init-declarator");
+ declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
return error_mark_node;
}
*************** cp_parser_init_declarator (parser,
*** 9751,9757 ****
/* Check that the number of template-parameter-lists is OK. */
if (!cp_parser_check_declarator_template_parameters (parser,
declarator))
! return error_mark_node;
/* Enter the newly declared entry in the symbol table. If we're
processing a declaration in a class-specifier, we wait until
--- 9779,9788 ----
/* Check that the number of template-parameter-lists is OK. */
if (!cp_parser_check_declarator_template_parameters (parser,
declarator))
! {
! declarator_access_checks_lists = TREE_CHAIN (declarator_access_checks_lists);
! return error_mark_node;
! }
/* Enter the newly declared entry in the symbol table. If we're
processing a declaration in a class-specifier, we wait until
*************** cp_parser_init_declarator (parser,
*** 9846,9851 ****
--- 9877,9884 ----
`explicit' constructor cannot be used. */
((is_parenthesized_init || !is_initialized)
? 0 : LOOKUP_ONLYCONVERTING));
+
+ declarator_access_checks = TREE_CHAIN (declarator_access_checks);
return decl;
}