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

            Bug ID: 86432
           Summary: ICE on capture VLA by reference
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tomilovanatoliy at yandex dot ru
  Target Milestone: ---

Code:

#include <iostream>

int main(int argc, char * argv[])
{
    char * v[argc];
    for (int c = 0; c < argc; ++c) {
        v[c] = argv[c];
    }
    [&v]
    {
        std::cout << sizeof(v) << std::endl;
    }();
}

Error (command line `g++ prog.cc -Wall -Wextra -std=gnu++2a`):

prog.cc: In lambda function:
prog.cc:11:30: warning: '<anonymous>' is used uninitialized in this function
[-Wuninitialized]
         std::cout << sizeof(v) << std::endl;
                              ^
during RTL pass: expand
prog.cc:11:30: internal compiler error: in expand_expr_real_1, at expr.c:9907
0x591cb6 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../source/gcc/expr.c:9901
0x89c9dd expand_expr
        ../../source/gcc/expr.h:279
0x89c9dd expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        ../../source/gcc/expr.c:8418
0x79d0c7 expand_gimple_stmt_1
        ../../source/gcc/cfgexpand.c:3673
0x79d0c7 expand_gimple_stmt
        ../../source/gcc/cfgexpand.c:3734
0x79e75f expand_gimple_basic_block
        ../../source/gcc/cfgexpand.c:5765
0x7a38c6 execute
        ../../source/gcc/cfgexpand.c:6368

Reply via email to