[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jakub Jelinek  ---
Fixed.

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Wed Feb 28 18:57:38 2018
New Revision: 258080

URL: https://gcc.gnu.org/viewcvs?rev=258080=gcc=rev
Log:
PR c++/84609
* parser.c (cp_parser_attributes_opt): Formatting fix.
(cp_parser_skip_balanced_tokens, cp_parser_skip_gnu_attributes_opt,
cp_parser_skip_std_attribute_spec_seq, cp_parser_skip_attributes_opt):
New functions.
(cp_parser_member_declaration): Use cp_parser_skip_attributes_opt
instead of tentative parse to peek over optional attribute tokens
to check for CPP_COLON after them.

* g++.dg/cpp0x/pr84609.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/pr84609.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

--- Comment #4 from Jason Merrill  ---
(In reply to Jakub Jelinek from comment #3)
> Created attachment 43529 [details]
> gcc8-pr84609.patch
> 
> Untested fix.

Looks good.

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

Jakub Jelinek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek  ---
Created attachment 43529
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43529=edit
gcc8-pr84609.patch

Untested fix.

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

Jakub Jelinek  changed:

   What|Removed |Added

 CC||jason at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek  ---
The:
23637 /* The following code wants to know early if it is a
bit-field
23638or some other declaration.  Attributes can appear before
23639the `:' token, but are hopefully rare enough that the
23640simplicity of the tentative lookup pays off.  */
23641 if (cp_next_tokens_can_be_attribute_p (parser)
23642 || (token->type == CPP_NAME
23643 && cp_nth_tokens_can_be_attribute_p (parser, 2)
23644 && (named_bitfld = true)))
23645   {
23646 cp_parser_parse_tentatively (parser);
23647 if (named_bitfld)
23648   cp_lexer_consume_token (parser->lexer);
23649 cp_parser_attributes_opt (parser);
23650 token = cp_lexer_peek_token (parser->lexer);
23651 is_bitfld = cp_lexer_next_token_is (parser->lexer,
CPP_COLON);
23652 cp_parser_abort_tentative_parse (parser);
23653   }
code assumes that during parsing of the attribute(s) we don't commit the
tentative parsing and it can be unconditionally undone, which is not the case
here, because in:
#0  cp_parser_commit_to_tentative_parse (parser=0x77ff6bd0) at
../../gcc/cp/parser.c:28976
#1  0x009d267a in cp_parser_parameter_declaration
(parser=0x77ff6bd0, template_parm_p=false, parenthesized_p=0x7fffc26f)
at ../../gcc/cp/parser.c:21547
#2  0x009d1ed0 in cp_parser_parameter_declaration_list
(parser=0x77ff6bd0, is_error=0x7fffc317) at ../../gcc/cp/parser.c:21305
#3  0x009d1d20 in cp_parser_parameter_declaration_clause
(parser=0x77ff6bd0) at ../../gcc/cp/parser.c:21228
#4  0x009bca81 in cp_parser_lambda_declarator_opt
(parser=0x77ff6bd0, lambda_expr=)
at ../../gcc/cp/parser.c:10517
#5  0x009bbe71 in cp_parser_lambda_expression (parser=0x77ff6bd0)
at ../../gcc/cp/parser.c:10172
#6  0x009b1217 in cp_parser_primary_expression (parser=0x77ff6bd0,
address_p=false, cast_p=false, template_arg_p=false, 
decltype_p=false, idk=0x7fffc8ec) at ../../gcc/cp/parser.c:5257
#7  0x009b539c in cp_parser_postfix_expression (parser=0x77ff6bd0,
address_p=false, cast_p=false, member_access_only_p=false, 
decltype_p=false, pidk_return=0x0) at ../../gcc/cp/parser.c:7026
#8  0x009b89aa in cp_parser_unary_expression (parser=0x77ff6bd0,
pidk=0x0, address_p=false, cast_p=false, decltype_p=false)
at ../../gcc/cp/parser.c:8318
#9  0x009b9ac6 in cp_parser_cast_expression (parser=0x77ff6bd0,
address_p=false, cast_p=false, decltype_p=false, pidk=0x0)
at ../../gcc/cp/parser.c:9086
#10 0x009b9bc3 in cp_parser_binary_expression (parser=0x77ff6bd0,
cast_p=false, no_toplevel_fold_p=false, decltype_p=false, 
prec=PREC_NOT_OPERATOR, pidk=0x0) at ../../gcc/cp/parser.c:9187
#11 0x009ba9a0 in cp_parser_assignment_expression
(parser=0x77ff6bd0, pidk=0x0, cast_p=false, decltype_p=false)
at ../../gcc/cp/parser.c:9482
#12 0x009b758c in cp_parser_parenthesized_expression_list
(parser=0x77ff6bd0, is_attribute_list=1, cast_p=false, 
allow_expansion_p=false, non_constant_p=0x0, close_paren_loc=0x0,
wrap_locations_p=false) at ../../gcc/cp/parser.c:7760
#13 0x009d99f3 in cp_parser_gnu_attribute_list (parser=0x77ff6bd0)
at ../../gcc/cp/parser.c:25047
#14 0x009d9839 in cp_parser_gnu_attributes_opt (parser=0x77ff6bd0)
at ../../gcc/cp/parser.c:24965
#15 0x009d9772 in cp_parser_attributes_opt (parser=0x77ff6bd0) at
../../gcc/cp/parser.c:24922
#16 0x009d74d9 in cp_parser_member_declaration (parser=0x77ff6bd0)
at ../../gcc/cp/parser.c:23649

we in:
21531 /* After seeing a decl-specifier-seq, if the next token is not a
21532"(", there is no possibility that the code is a valid
21533expression.  Therefore, if parsing tentatively, we commit at
21534this point.  */
21535 if (!parser->in_template_argument_list_p
21536 /* In an expression context, having seen:
21537   
21538  (int((char ...
21539   
21540we cannot be sure whether we are looking at a
21541function-type (taking a "char" as a parameter) or a cast
21542of some object of type "char" to "int".  */
21543 && !parser->in_type_id_in_expr_p
21544 && cp_parser_uncommitted_to_tentative_parse_p (parser)
21545 && cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)
21546 && cp_lexer_next_token_is_not 

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

Martin Liška  changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||marxin at gcc dot gnu.org
  Known to fail||8.0

--- Comment #1 from Martin Liška  ---
Confirmed, started with r253281.

[Bug c++/84609] [8 Regression] internal compiler error: in cp_parser_abort_tentative_parse, at cp/parser.c:28960 (cp_parser_member_declaration())

2018-02-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84609

Richard Biener  changed:

   What|Removed |Added

   Keywords||ice-on-invalid-code
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-02-28
  Known to work||7.3.0
   Target Milestone|--- |8.0
Summary|internal compiler error: in |[8 Regression] internal
   |cp_parser_abort_tentative_p |compiler error: in
   |arse, at cp/parser.c:28960  |cp_parser_abort_tentative_p
   |(cp_parser_member_declarati |arse, at cp/parser.c:28960
   |on())   |(cp_parser_member_declarati
   ||on())
 Ever confirmed|0   |1