From: Jakub Jelinek Date: Tue, 20 Sep 2016 15:16:55 +0000 (+0200) Subject: re PR c++/77637 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check, cp_parser_s... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=590b62e90d6d86e68442ffa608c7c6e5653736d5;p=gcc.git re PR c++/77637 (ICE on x86_64-linux-gnu (Segmentation fault, tree_check, cp_parser_std_attribute_list...)) PR c++/77637 * parser.c (cp_parser_std_attribute_list): Reject ... without preceding attribute. * g++.dg/cpp0x/gen-attrs-62.C: New test. From-SVN: r240265 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6aa79a9409f..35ad431723d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-09-20 Jakub Jelinek + + PR c++/77637 + * parser.c (cp_parser_std_attribute_list): Reject ... without + preceding attribute. + 2016-09-19 Bernd Edlinger PR c++/77434 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c03b9c2e5e3..9a20a5f0945 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24221,8 +24221,12 @@ cp_parser_std_attribute_list (cp_parser *parser, tree attr_ns) if (token->type == CPP_ELLIPSIS) { cp_lexer_consume_token (parser->lexer); - TREE_VALUE (attribute) - = make_pack_expansion (TREE_VALUE (attribute)); + if (attribute == NULL_TREE) + error_at (token->location, + "expected attribute before %<...%>"); + else + TREE_VALUE (attribute) + = make_pack_expansion (TREE_VALUE (attribute)); token = cp_lexer_peek_token (parser->lexer); } if (token->type != CPP_COMMA) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d434027b52b..b4524f062e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-09-20 Jakub Jelinek + PR c++/77637 + * g++.dg/cpp0x/gen-attrs-62.C: New test. + PR middle-end/77624 * c-c++-common/pr77624-1.c: New test. * c-c++-common/pr77624-2.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C new file mode 100644 index 00000000000..5bd8778707b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-62.C @@ -0,0 +1,5 @@ +// PR c++/77637 +// { dg-do compile { target c++11 } } + +int [[...]] a; // { dg-error "expected attribute before '...'" } +int [[,,...]] b; // { dg-error "expected attribute before '...'" }