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

            Bug ID: 90732
           Summary: regression - ICE with std::apply after variable length
                    array
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v at vsamko dot com
  Target Milestone: ---

With -O0 -std=c++17 this results in ICE

#include <tuple>
#include <algorithm>

volatile size_t SIZE = 100;

template<typename... Ts>
void foo(Ts&... out) {
    std::tuple<Ts...> dummy;
    char buf[SIZE];
    std::apply([&buf, &out...](auto&... x) { (x, ...); }, dummy);
}

int main() {
    int x1;
    foo(x1);
}


during RTL pass: expand
test.cpp: In lambda function:
test.cpp:10:16: internal compiler error: in expand_expr_real_1, at expr.c:10012
   10 |     std::apply([&buf, &out...](auto&... x) { (x, ...); }, dummy);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x79d4d9 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc-9.1.0/gcc/expr.c:10012
0x1236818 expand_expr_real(tree_node*, rtx_def*, machine_mode, expand_modifier,
rtx_def**, bool)
        ../../gcc-9.1.0/gcc/expr.c:8275
0x1236818 expand_expr
        ../../gcc-9.1.0/gcc/expr.h:279
0x1236818 expand_operands(tree_node*, tree_node*, rtx_def*, rtx_def**,
rtx_def**, expand_modifier)
        ../../gcc-9.1.0/gcc/expr.c:7873
0x123082a expand_expr_real_2(separate_ops*, rtx_def*, machine_mode,
expand_modifier)
        ../../gcc-9.1.0/gcc/expr.c:8733
0x115d279 expand_gimple_stmt_1
        ../../gcc-9.1.0/gcc/cfgexpand.c:3789
0x115d279 expand_gimple_stmt
        ../../gcc-9.1.0/gcc/cfgexpand.c:3850
0x11579de expand_gimple_basic_block
        ../../gcc-9.1.0/gcc/cfgexpand.c:5886
0x11579de execute
        ../../gcc-9.1.0/gcc/cfgexpand.c:6509
Please submit a full bug report,

Reply via email to