This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/65525] New: ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432)


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

            Bug ID: 65525
           Summary: ICE: sorry, unimplemented: unexpected AST of kind
                    mem_ref (-std=c++14, ICE: in
                    potential_constant_expression_1, at
                    cp/constexpr.c:4432)
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marciso.gcc at gmail dot com

// The following code triggers "unimplemented ICE" when compiled with
"-std=c++14";
// "-std=c++11" compiles fine.

// g++ -std=c++14 test.cpp
// Tested with:
//   g++ (GCC) 5.0.0 20150308 (experimental)
//   g++ (GCC) 5.0.0 20150323 (experimental)

struct A
{
    int x;
    char y; // Actually, short and bool (types smaller than int?) trigger this
ICE too
    // Also: the problem doesn't occur if you put the smaller type first, e.g.
"char x; int y;"

    A(int x) {} // custom ctor needed for ICE
};

int main()
{
    A a{0}, x{1}, y{2};

    x = a; // OK
    y = a; // OK
    x = y = a; // ICE: sorry, unimplemented: unexpected AST of kind mem_ref
    // internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:4432

    return 0;
}

/*
./gcc/bin/g++ -std=c++14    test.cpp   -o test
test.cpp: In function âint main()â:
test.cpp:20:13: sorry, unimplemented: unexpected AST of kind mem_ref
     x = y = a; // ICE: sorry, unimplemented: unexpected AST of kind mem_ref
             ^
test.cpp:20:13: internal compiler error: in potential_constant_expression_1, at
cp/constexpr.c:4432
0x843238 potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4432
0x842eca potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4049
0x8423e5 potential_constant_expression_1
        ../../gcc/cp/constexpr.c:4379
0x74c3d2 cp_parser_constant_expression
        ../../gcc/cp/parser.c:8672
0x74c0b4 cp_parser_assignment_expression
        ../../gcc/cp/parser.c:8434
0x74e80d cp_parser_expression
        ../../gcc/cp/parser.c:8569
0x74f0f6 cp_parser_expression_statement
        ../../gcc/cp/parser.c:9976
0x73c8b5 cp_parser_statement
        ../../gcc/cp/parser.c:9827
0x73d422 cp_parser_statement_seq_opt
        ../../gcc/cp/parser.c:10099
0x73d57b cp_parser_compound_statement
        ../../gcc/cp/parser.c:10053
0x75233b cp_parser_function_body
        ../../gcc/cp/parser.c:19185
0x75233b cp_parser_ctor_initializer_opt_and_function_body
        ../../gcc/cp/parser.c:19221
0x75cbaa cp_parser_function_definition_after_declarator
        ../../gcc/cp/parser.c:23464
0x75da23 cp_parser_function_definition_from_specifiers_and_declarator
        ../../gcc/cp/parser.c:23376
0x75da23 cp_parser_init_declarator
        ../../gcc/cp/parser.c:17055
0x75efbc cp_parser_simple_declaration
        ../../gcc/cp/parser.c:11592
0x75f313 cp_parser_block_declaration
        ../../gcc/cp/parser.c:11466
0x767879 cp_parser_declaration
        ../../gcc/cp/parser.c:11363
0x767afa cp_parser_declaration_seq_opt
        ../../gcc/cp/parser.c:11249
0x767e0f cp_parser_translation_unit
        ../../gcc/cp/parser.c:4100
Please submit a full bug report,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]