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

            Bug ID: 102406
           Summary: ICE on array declaration sized by a struct member
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkeir at outlook dot com
  Target Milestone: ---

Created attachment 51483
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51483&action=edit
The code described in the bug report.

Compiling the code below (also attached) produces an internal compiler error.

struct Foo { unsigned x_; };

int main(int argc, char *argv[])
{
  const Foo a{3};
  float f[2][a.x_]{};
  return 0;
}

The full error is below:

internal compiler error: in make_decl_rtl, at varasm.c:1446
    6 |   float f[2][a.x_]{};
      |         ^
0x86bd48 make_decl_rtl(tree_node*)
        ../../gcc/varasm.c:1446
0xda0967 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:10457
0xdb274b expand_constructor
        ../../gcc/expr.c:8491
0xda015a expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:10749
0xdac0ec store_expr(tree_node*, rtx_def*, int, bool, bool)
        ../../gcc/expr.c:5994
0xdb1ab7 store_field
        ../../gcc/expr.c:7491
0xdae17d expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc/expr.c:5589
0xc76a37 expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3945
0xc76a37 expand_gimple_stmt
        ../../gcc/cfgexpand.c:4043
0xc7cf03 expand_gimple_basic_block
        ../../gcc/cfgexpand.c:6085
0xc7ecb7 execute
        ../../gcc/cfgexpand.c:6811

Reply via email to