https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79331
Bug ID: 79331 Summary: ICE on valid C++14 code (with initialized lambda capture) on x86_64-linux-gnu: in canonicalize_component_ref, at gimplify.c:2451 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The ICE seems to be a recent regression, but the code is mistakenly rejected by earlier versions of GCC. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.1 20170201 (experimental) [trunk revision 245083] (GCC) $ $ icc -c -std=c++14 small.cpp $ clang++ -c -std=c++14 small.cpp $ $ g++-trunk -c -std=c++14 small.cpp small.cpp: In lambda function: small.cpp:9:14: error: field ‘bar()::<lambda()>::<lambda()>::<f capture>’ invalidly declared function type return f (); ^ small.cpp: In lambda function: small.cpp:9:16: internal compiler error: in canonicalize_component_ref, at gimplify.c:2451 return f (); ~~^~ 0xb8ade3 canonicalize_component_ref ../../gcc-source-trunk/gcc/gimplify.c:2451 0xbaaa37 gimplify_compound_lval ../../gcc-source-trunk/gcc/gimplify.c:2877 0xba0761 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11155 0xba08b0 gimplify_addr_expr ../../gcc-source-trunk/gcc/gimplify.c:5860 0xba08b0 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11249 0xbac0a6 gimplify_call_expr ../../gcc-source-trunk/gcc/gimplify.c:3183 0xba1275 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11174 0xbaf657 gimplify_modify_expr ../../gcc-source-trunk/gcc/gimplify.c:5457 0xba26ec gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11203 0xba52c6 gimplify_stmt(tree_node**, gimple**) ../../gcc-source-trunk/gcc/gimplify.c:6478 0xba1a3f gimplify_and_add(tree_node*, gimple**) ../../gcc-source-trunk/gcc/gimplify.c:435 0xba1a3f gimplify_return_expr ../../gcc-source-trunk/gcc/gimplify.c:1521 0xba1a3f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11462 0xba52c6 gimplify_stmt(tree_node**, gimple**) ../../gcc-source-trunk/gcc/gimplify.c:6478 0xba132b gimplify_cleanup_point_expr ../../gcc-source-trunk/gcc/gimplify.c:6230 0xba132b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11578 0xba52c6 gimplify_stmt(tree_node**, gimple**) ../../gcc-source-trunk/gcc/gimplify.c:6478 0xba1a9b gimplify_statement_list ../../gcc-source-trunk/gcc/gimplify.c:1716 0xba1a9b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc-source-trunk/gcc/gimplify.c:11630 0xba52c6 gimplify_stmt(tree_node**, gimple**) ../../gcc-source-trunk/gcc/gimplify.c:6478 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. $ -------------------------------- int foo (); int bar () { return [&f (foo)] { return [=] { return f (); } (); } (); }