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

            Bug ID: 90319
           Summary: [C++17] aggregate initialization of base: ICE in
                    assign_temp
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: language.lawyer at gmail dot com
  Target Milestone: ---

This bug is similar to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90254, but
here the base is movable.

The following code:

struct B
{
        B() = default;
        B(B&&) { /* user-provided */ };
};
struct D : B {};

B f() { return {}; }

D a { f() };

triggers ICE in GCC HEAD 10.0.0 2019.04.30 (also reproducible in 8.x.y, 7.z.w):

$ g++ prog.cc -Wall -Wextra -std=c++17 prog.cc

during RTL pass: expand
prog.cc: In function 'void __static_initialization_and_destruction_0(int,
int)':
prog.cc:10:11: internal compiler error: in assign_temp, at function.c:982
   10 | D a { f() };
      |           ^
0x596de0 assign_temp(tree_node*, int, int)
        ../../source/gcc/function.c:982
0x7b185f expand_call(tree_node*, rtx_def*, int)
        ../../source/gcc/calls.c:3459
0x8b0236 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../source/gcc/expr.c:11033
0x8bdc73 expand_normal
        ../../source/gcc/expr.h:285
0x8bdc73 store_field
        ../../source/gcc/expr.c:7022
0x8bb2d3 expand_assignment(tree_node*, tree_node*, bool)
        ../../source/gcc/expr.c:5296
0x7bd3d0 expand_call_stmt
        ../../source/gcc/cfgexpand.c:2722
0x7bd3d0 expand_gimple_stmt_1
        ../../source/gcc/cfgexpand.c:3691
0x7bd3d0 expand_gimple_stmt
        ../../source/gcc/cfgexpand.c:3850
0x7c20f7 expand_gimple_basic_block
        ../../source/gcc/cfgexpand.c:5886
0x7c448e execute
        ../../source/gcc/cfgexpand.c:6509
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.

(https://wandbox.org/permlink/f8QAVgCtSajxfG3L)


! There is no ICE if a positive optimization level (-O1/2/3) is specified !

Reply via email to