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

            Bug ID: 57751
           Summary: internal compiler error: in cxx_eval_indirect_ref, at
                    cp/semantics.c:7648
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jan.kiszka at siemens dot com

Trying to compile code of this pattern

  extern unsigned long ADDR;   

  unsigned long f(){
    const unsigned long* const var=(unsigned long*)(&ADDR);
    const unsigned long retval=var[1];
    return retval;
  }

with gcc 4.8.1 like this

  g++ -c gcc-4.8.1-crash.cpp

we get the following internal error:

gcc-4.8.1-crash.cpp: In function 'long unsigned int f()':
gcc-4.8.1-crash.cpp:5:35: internal compiler error: in cxx_eval_indirect_ref, at
cp/semantics.c:7648
   const unsigned long retval=var[1];
                                   ^
0x5bf32f cxx_eval_indirect_ref
        ../../gcc/cp/semantics.c:7647
0x5bf32f cxx_eval_constant_expression
        ../../gcc/cp/semantics.c:7884
0x5bd9e1 cxx_eval_constant_expression
        ../../gcc/cp/semantics.c:8065
0x5bfbf6 cxx_eval_outermost_constant_expr
        ../../gcc/cp/semantics.c:8136
0x5c0ef8 maybe_constant_init(tree_node*)
        ../../gcc/cp/semantics.c:8264
0x545107 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/cp/typeck2.c:714
0x5125d5 check_initializer
        ../../gcc/cp/decl.c:5728
0x520475 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/cp/decl.c:6347
0x580b03 cp_parser_init_declarator
        ../../gcc/cp/parser.c:16142
0x58130e cp_parser_simple_declaration
        ../../gcc/cp/parser.c:10670
0x582e10 cp_parser_block_declaration
        ../../gcc/cp/parser.c:10551
0x583e30 cp_parser_declaration_statement
        ../../gcc/cp/parser.c:10195
0x570177 cp_parser_statement
        ../../gcc/cp/parser.c:8966
0x57139e cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:9238
0x5714be cp_parser_compound_statement
        ../../gcc/cp/parser.c:9192
0x57f638 cp_parser_function_body
        ../../gcc/cp/parser.c:17827
0x57f638 cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:17863
0x58036f cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:21843
0x580f83 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:21764
0x580f83 cp_parser_init_declarator
        ../../gcc/cp/parser.c:15922


This doesn't happen when compiling as C or using older gcc (confirmed for 4.5.1
at least).

Reply via email to