https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78363
Bug ID: 78363 Summary: internal compiler error: in force_type_die, at dwarf2out.c:24864 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: andrey.y.guskov at intel dot com Target Milestone: --- Consider the following code snippet (a very abridged version of libgomp/testsuite/libgomp.c++/pr58706.C): int main() { int n = 0; #pragma omp parallel for reduction (+: n) for (int i = [](){ return 3; }(); i < 10; ++i) n++; return n; } This is what happens when I attempt to compile it: $ build_ext/bin/g++ -v Using built-in specs. COLLECT_GCC=/<path>/build_ext/bin/g++ COLLECT_LTO_WRAPPER=/<path>/build_ext/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /<path>/source/configure --prefix=/<path>/build_ext --with-system-zlib --with-demangler-in-ld --with-fpmath=sse --with-arch=haswell --with-cpu=haswell --enable-shared --enable-host-shared --enable-clocale=gnu --enable-cloog-backend=isl --enable-languages=c,c++,fortran,jit,lto Thread model: posix gcc version 7.0.0 20161115 (experimental) (GCC) $ build_ext/bin/g++ fail.cpp -fopenmp āg fail.cpp: In lambda function: fail.cpp:6:34: internal compiler error: in force_type_die, at dwarf2out.c:24864 for (int i = [](){ return 3; }(); i < 10; ++i) ^ 0xa16d0e force_type_die /<path>/source/gcc/dwarf2out.c:24864 0xa16463 get_context_die /<path>/source/gcc/dwarf2out.c:24778 0xa16463 force_decl_die /<path>/source/gcc/dwarf2out.c:24797 0xa14078 gen_subprogram_die /<path>/source/gcc/dwarf2out.c:21722 0xa14e74 gen_decl_die /<path>/source/gcc/dwarf2out.c:25100 0xa15dfe dwarf2out_decl /<path>/source/gcc/dwarf2out.c:25607 0xa3312e dwarf2out_function_decl /<path>/source/gcc/dwarf2out.c:25622 0xa91dba rest_of_handle_final /<path>/source/gcc/final.c:4508 0xa91dba execute /<path>/source/gcc/final.c:4550 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. Without the last ā-gā it compiles fine and returns 7, just as expected.