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

            Bug ID: 58646
           Summary: ICEs initializing VLAs
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: reichelt at gcc dot gnu.org

The following related 4 code snippets trigger ICEs on trunk in different parts
of the compiler:

The first one crashes without any compiler options:

=========================
void foo(int n)
{
  int a[2][n] = {};
}
=========================

bug.cc: In function 'void foo(int)':
bug.cc:3:18: internal compiler error: in make_decl_rtl, at varasm.c:1214
   int a[2][n] = {};
                  ^
0xd24d63 make_decl_rtl(tree_node*)
        ../../gcc/gcc/varasm.c:1210
0x8a9409 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
        ../../gcc/gcc/expr.c:9320
0x8be7e7 expand_constructor
        ../../gcc/gcc/expr.c:7713
0x8a9244 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**)
        ../../gcc/gcc/expr.c:9557
0x8b3158 store_expr(tree_node*, rtx_def*, int, bool)
        ../../gcc/gcc/expr.c:5207
0x8b5569 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc/gcc/expr.c:4853
0x7df05d expand_gimple_stmt_1
        ../../gcc/gcc/cfgexpand.c:2274
0x7df05d expand_gimple_stmt
        ../../gcc/gcc/cfgexpand.c:2370
0x7e0ab3 expand_gimple_basic_block
        ../../gcc/gcc/cfgexpand.c:4209
0x7e23dc gimple_expand_cfg
        ../../gcc/gcc/cfgexpand.c:4728
0x7e23dc execute
        ../../gcc/gcc/cfgexpand.c:4942
Please submit a full bug report, [etc.]


The second one crashes if compiled with "-std=c++11":

=========================
void foo(int n)
{
  int a[n][2] = {};
}
=========================

bug.cc: In function 'void foo(int)':
bug.cc:3:18: internal compiler error: in gimplify_init_constructor, at
gimplify.c:4236
   int a[n][2] = {};
                  ^
0x96f293 gimplify_init_constructor
        ../../gcc/gcc/gimplify.c:4236
0x970a7e gimplify_modify_expr_rhs
        ../../gcc/gcc/gimplify.c:4518
0x970de4 gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4834
0x9661d5 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7332
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x9656fe gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5485
0x9656fe gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7669
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x9656fe gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5485
0x9656fe gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7669
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
Please submit a full bug report, [etc.]


The third one also crashes if compiled with "-std=c++11":

=========================
void foo(int n)
{
  int a[n][2][n] = {};
}
=========================

bug.cc: In function 'void foo(int)':
bug.cc:3:21: internal compiler error: in create_tmp_var, at gimplify.c:438
   int a[n][2][n] = {};
                     ^
0x962923 create_tmp_var(tree_node*, char const*)
        ../../gcc/gcc/gimplify.c:438
0x9641fc create_tmp_from_val
        ../../gcc/gcc/gimplify.c:521
0x9641fc lookup_tmp_var
        ../../gcc/gcc/gimplify.c:543
0x9641fc internal_get_tmp_var
        ../../gcc/gcc/gimplify.c:587
0x964bae gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:8163
0x96bb54 gimplify_compound_lval
        ../../gcc/gcc/gimplify.c:2257
0x965fa4 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7284
0x965010 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7728
0x970f58 gimplify_modify_expr
        ../../gcc/gcc/gimplify.c:4875
0x9661d5 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7332
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x9656fe gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5485
0x9656fe gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7669
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
Please submit a full bug report, [etc.]


The last one crashes if compiled with "-std=c++1y":

=========================
void foo(int n)
{
  int a[n][n] = {};
}
=========================

bug.cc: In function 'void foo(int)':
bug.cc:3:13: warning: array of array of runtime bound [-Wvla]
   int a[n][n] = {};
             ^
bug.cc:3:18: internal compiler error: in build2_stat, at tree.c:4104
   int a[n][n] = {};
                  ^
0xce51e0 build2_stat(tree_code, tree_node*, tree_node*, tree_node*)
        ../../gcc/gcc/tree.c:4103
0x9026bf build2_stat_loc
        ../../gcc/gcc/tree.h:3391
0x9026bf fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ../../gcc/gcc/fold-const.c:15053
0x96b573 gimplify_self_mod_expr(tree_node**, gimple_statement_d**,
gimple_statement_d**, bool, tree_node*)
        ../../gcc/gcc/gimplify.c:2375
0x965d6d gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7274
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x9656fe gimplify_cleanup_point_expr
        ../../gcc/gcc/gimplify.c:5485
0x9656fe gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7669
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x964f9b gimplify_statement_list
        ../../gcc/gcc/gimplify.c:1525
0x964f9b gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7721
0x9691a6 gimplify_stmt(tree_node**, gimple_statement_d**)
        ../../gcc/gcc/gimplify.c:5709
0x969e7d gimplify_bind_expr
        ../../gcc/gcc/gimplify.c:1213
0x965f50 gimplify_expr(tree_node**, gimple_statement_d**, gimple_statement_d**,
bool (*)(tree_node*), int)
        ../../gcc/gcc/gimplify.c:7503
Please submit a full bug report, [etc.]

Reply via email to