https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95954

            Bug ID: 95954
           Summary: ICE: unexpected expression ‘(a)’ of kind paren_expr
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code, bug.cc, reduced by C-Reduce, makes GCC-trunk ICE.

$cat bug.cc
short a;
thread_local b ( auto , = ( a ;

$g++ -w bug.cc
bug.cc:2:25: error: expected identifier before ‘=’ token
    2 | thread_local b ( auto , = ( a ;
      |                         ^
bug.cc:2:30: error: expected ‘)’ before ‘;’ token
    2 | thread_local b ( auto , = ( a ;
      |                           ~  ^~
      |                              )
bug.cc:2:30: error: expected ‘)’ before ‘;’ token
    2 | thread_local b ( auto , = ( a ;
      |                ~             ^~
      |                              )
bug.cc:2:14: error: ISO C++ forbids declaration of ‘b’ with no type
[]8;;https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-fpermissive-fpermissive]8;;]
    2 | thread_local b ( auto , = ( a ;
      |              ^
bug.cc:2:31: internal compiler error: unexpected expression ‘(a)’ of kind
paren_expr
    2 | thread_local b ( auto , = ( a ;
      |                               ^
0x8b06d4 cxx_eval_constant_expression
        ../../gcc/cp/constexpr.c:6503
0x8b0c1f cxx_eval_outermost_constant_expr
        ../../gcc/cp/constexpr.c:6708
0x8b500b maybe_constant_value(tree_node*, tree_node*, bool)
        ../../gcc/cp/constexpr.c:6981
0x8ddc74 cp_fully_fold(tree_node*)
        ../../gcc/cp/cp-gimplify.c:2464
0x8e51cf cp_convert_and_check(tree_node*, tree_node*, int)
        ../../gcc/cp/cvt.c:661
0x8724df convert_like_real
        ../../gcc/cp/call.c:7865
0x873c29 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int)
        ../../gcc/cp/call.c:11870
0x8f887f check_default_argument(tree_node*, tree_node*, int)
        ../../gcc/cp/decl.c:13923
0x8f8edf grokparms(tree_node*, tree_node**)
        ../../gcc/cp/decl.c:14111
0x90a23b grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/cp/decl.c:12393
0x915628 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/cp/decl.c:5233
0x9c1e6d cp_parser_init_declarator
        ../../gcc/cp/parser.c:20818
0x9a36d2 cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13785
0x9cc926 cp_parser_declaration
        ../../gcc/cp/parser.c:13484
0x9cd06a cp_parser_translation_unit
        ../../gcc/cp/parser.c:4761
0x9cd06a c_parse_file()
        ../../gcc/cp/parser.c:44043
0xae4dbb c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1190
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$g++ --version
g++ (GCC) 11.0.0 20200626 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to