From 08028093211c1b57f33e5669f816157934ab23dd Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Tue, 17 Nov 2020 20:05:22 +0000 Subject: [PATCH] Objective-C++ : Avoid ICE on invalid with empty attributes. Empty prefix attributes like: __attribute__ (()) @interface MyClass @end cause an ICE at present, check for that case and skip them. gcc/cp/ChangeLog: * parser.c (cp_parser_objc_valid_prefix_attributes): Check for empty attributes. --- gcc/cp/parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index b7ef259b048..cf4e4aa1b75 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -33992,8 +33992,8 @@ cp_parser_objc_valid_prefix_attributes (cp_parser* parser, tree *attrib) { cp_lexer_save_tokens (parser->lexer); tree addon = cp_parser_attributes_opt (parser); - gcc_checking_assert (addon); - if (OBJC_IS_AT_KEYWORD (cp_lexer_peek_token (parser->lexer)->keyword)) + if (addon + && OBJC_IS_AT_KEYWORD (cp_lexer_peek_token (parser->lexer)->keyword)) { cp_lexer_commit_tokens (parser->lexer); if (*attrib) -- 2.30.2