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

            Bug ID: 85761
           Summary: ICE on invalid in rtl with uncaptured constexpr
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sshannin at gmail dot com
  Target Milestone: ---

Reduced test case shown below. Easily resolved by fixing the code (capturing
COUNT or just moving its decl into the lambda), so not that interesting, but
still an ICE. 

Compiled fine with 7.1.0.

Stacktrace looks similar to pr85594, but a tad different and doesn't involve
OpenMP.

********************************************
seth@dev9:~$ cat tmp.cpp 
template <typename T>
void out(const T& value);

struct foo {
    void bar();
};

void foo::bar()
{
    constexpr int COUNT = 10000;
    auto run = []() {
        out(COUNT);
    };

    run();
}


seth@dev9:~$ /build/toolchain13/bin/g++ tmp.cpp 
during RTL pass: expand
tmp.cpp: In lambda function:
tmp.cpp:12:13: internal compiler error: in make_decl_rtl, at varasm.c:1322
         out(COUNT);
             ^~~~~
0x429b54 make_decl_rtl(tree_node*)
        ../../gcc_8_1_0/gcc/varasm.c:1318
0x715721 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc_8_1_0/gcc/expr.c:9962
0x71e3ee expand_expr
        ../../gcc_8_1_0/gcc/expr.h:280
0x71e3ee expand_expr_addr_expr_1
        ../../gcc_8_1_0/gcc/expr.c:7943
0x714135 expand_expr_addr_expr
        ../../gcc_8_1_0/gcc/expr.c:8064
0x714135 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc_8_1_0/gcc/expr.c:11236
0x71ea7b store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool,
tree_node*)
        ../../gcc_8_1_0/gcc/expr.c:5635
0x71fd84 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc_8_1_0/gcc/expr.c:5403
0x623eb0 expand_gimple_stmt_1
        ../../gcc_8_1_0/gcc/cfgexpand.c:3692
0x623eb0 expand_gimple_stmt
        ../../gcc_8_1_0/gcc/cfgexpand.c:3790
0x6255ff expand_gimple_basic_block
        ../../gcc_8_1_0/gcc/cfgexpand.c:5819
0x62a996 execute
        ../../gcc_8_1_0/gcc/cfgexpand.c:6425
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.


seth@dev9:~$ /build/toolchain13/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/build/toolchain13/bin/g++
COLLECT_LTO_WRAPPER=/build/toolchain13/libexec/gcc/x86_64-pc-linux-gnu/8.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc_8_1_0/configure --prefix=/build/toolchain13
--enable-languages=c,c++ --enable-lto --disable-plugin --program-suffix=-8.1.0
--disable-multilib --disable-shared
Thread model: posix
gcc version 8.1.0 (GCC)

Reply via email to