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] PR 78344 ("ICE on invalid c++ code (tree check: expected tree_list, have error_mark in cp_check_const_attributes, at cp/decl2.c:1347")


Hi,

in this error recovery issue cp_check_const_attributes and more generally cplus_decl_attributes have lots of troubles handling the error_mark_node returned by cp_parser_std_attribute_spec_seq, as called by cp_parser_direct_declarator. I fiddled quite a bit with these parsing facilities to eventually notice that boldly changing cp_parser_std_attribute_spec_seq to return NULL_TREE instead of error_mark_node when cp_parser_std_attribute_spec returns error_mark_node in the loop cures the bug at issue as a special case.

I also noticed that in cp_parser_std_attribute_spec we are using token_pair::require_open / require_close very peculiarly, issuing a cp_parser_error when the returned bool is false instead of simply bailing out with error_mark_node and that in fact causes duplicate diagnostics about expected '(' / ')', respectively.

Tested x86_64-linux.

Thanks, Paolo.

///////////////////////////


Attachment: CL_78344_3
Description: Text document

Attachment: patch_78344_3
Description: Text document


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