[gcc r11-5147] Objective-C++ : Avoid ICE on invalid with empty attributes.
Iain D Sandoe
iains@gcc.gnu.org
Wed Nov 18 20:43:02 GMT 2020
https://gcc.gnu.org/g:08028093211c1b57f33e5669f816157934ab23dd
commit r11-5147-g08028093211c1b57f33e5669f816157934ab23dd
Author: Iain Sandoe <iain@sandoe.co.uk>
Date: Tue Nov 17 20:05:22 2020 +0000
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.
Diff:
---
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)
More information about the Gcc-cvs
mailing list