[Bug c++/58827] New: ICE in cxx_eval_constant_expression

rmansfield at qnx dot com gcc-bugzilla@gcc.gnu.org
Mon Oct 21 16:58:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58827

            Bug ID: 58827
           Summary: ICE in cxx_eval_constant_expression
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rmansfield at qnx dot com

Created attachment 31062
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31062&action=edit
preprocessed src

Two testcases reproduce the ICE in cxx_eval_constant_expression on gcc 4.8 and
4.9 (including fix for 58466)

$ ./xgcc -v
Using built-in specs.
COLLECT_GCC=./xgcc
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --disable-bootstrap --enable-languages=c++
--enable-checking=yes
Thread model: posix
gcc version 4.9.0 20131021 (experimental) [trunk revision 203899] (GCC) 

$ ./xg++ -B. -std=c++11 ~/ice.ii
/home/ryan/ice.ii: In function ‘void f(int)’:
/home/ryan/ice.ii:1:80: internal compiler error: unexpected expression
‘static_cast<unsigned int>(x)’ of kind static_cast_expr
 template <typename T> void f(int x) { const unsigned
y{static_cast<unsigned>(x)}; }
                                                                               
^
0x6cdfa5 cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9660
0x6d0f76 cxx_eval_outermost_constant_expr
    ../../gcc/cp/semantics.c:9680
0x6d3c2b maybe_constant_value(tree_node*)
    ../../gcc/cp/semantics.c:9790
0x5ddf8d check_narrowing(tree_node*, tree_node*)
    ../../gcc/cp/typeck2.c:842
0x55568f check_initializer
    ../../gcc/cp/decl.c:5669
0x568686 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
    ../../gcc/cp/decl.c:6253
0x655a56 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16640
0x65731e cp_parser_simple_declaration
    ../../gcc/cp/parser.c:11054
0x63add0 cp_parser_block_declaration
    ../../gcc/cp/parser.c:10935
0x63be90 cp_parser_declaration_statement
    ../../gcc/cp/parser.c:10582
0x63c547 cp_parser_statement
    ../../gcc/cp/parser.c:9333
0x63d7fe cp_parser_statement_seq_opt
    ../../gcc/cp/parser.c:9611
0x63d946 cp_parser_compound_statement
    ../../gcc/cp/parser.c:9565
0x650f83 cp_parser_function_body
    ../../gcc/cp/parser.c:18408
0x650f83 cp_parser_ctor_initializer_opt_and_function_body
    ../../gcc/cp/parser.c:18444
0x65530f cp_parser_function_definition_after_declarator
    ../../gcc/cp/parser.c:22452
0x656063 cp_parser_function_definition_from_specifiers_and_declarator
    ../../gcc/cp/parser.c:22373
0x656063 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16419
0x656444 cp_parser_single_declaration
    ../../gcc/cp/parser.c:22766
0x656750 cp_parser_template_declaration_after_export
    ../../gcc/cp/parser.c:22568
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


$ ./xg++ -B. -std=c++11 ~/ice2.ii
/home/ryan/ice2.ii: In function ‘void f(int)’:
/home/ryan/ice2.ii:3:56: internal compiler error: unexpected expression ‘g’ of
kind overload
 template <typename T> void f(int x) { const int a {g(x)}; }
                                                        ^
0x6cdfa5 cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9660
0x6cc7a6 cxx_eval_call_expression
    ../../gcc/cp/semantics.c:8244
0x6cdeef cxx_eval_constant_expression
    ../../gcc/cp/semantics.c:9367
0x6d0f76 cxx_eval_outermost_constant_expr
    ../../gcc/cp/semantics.c:9680
0x6d3c2b maybe_constant_value(tree_node*)
    ../../gcc/cp/semantics.c:9790
0x5ddf8d check_narrowing(tree_node*, tree_node*)
    ../../gcc/cp/typeck2.c:842
0x55568f check_initializer
    ../../gcc/cp/decl.c:5669
0x568686 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
    ../../gcc/cp/decl.c:6253
0x655a56 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16640
0x65731e cp_parser_simple_declaration
    ../../gcc/cp/parser.c:11054
0x63add0 cp_parser_block_declaration
    ../../gcc/cp/parser.c:10935
0x63be90 cp_parser_declaration_statement
    ../../gcc/cp/parser.c:10582
0x63c547 cp_parser_statement
    ../../gcc/cp/parser.c:9333
0x63d7fe cp_parser_statement_seq_opt
    ../../gcc/cp/parser.c:9611
0x63d946 cp_parser_compound_statement
    ../../gcc/cp/parser.c:9565
0x650f83 cp_parser_function_body
    ../../gcc/cp/parser.c:18408
0x650f83 cp_parser_ctor_initializer_opt_and_function_body
    ../../gcc/cp/parser.c:18444
0x65530f cp_parser_function_definition_after_declarator
    ../../gcc/cp/parser.c:22452
0x656063 cp_parser_function_definition_from_specifiers_and_declarator
    ../../gcc/cp/parser.c:22373
0x656063 cp_parser_init_declarator
    ../../gcc/cp/parser.c:16419
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


More information about the Gcc-bugs mailing list