https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123413
Bug ID: 123413
Summary: ICE: in gimplify_var_or_parm_decl, at gimplify.cc with
statement expression inside generic lambda
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jirehguo at tju dot edu.cn
Target Milestone: ---
Compiler Explorer: https://godbolt.org/z/sv9Pv7s4j
This ICE started appearing since GCC 6.1.
Program:
```cpp
template <class T>
void G(T &a) {
auto processor = [](auto&& func) {
return func();
};
auto result = processor([&]() {
auto x = 42;
decltype(auto) y = ({ decltype(x) z = x; z + 0; });
return 0;
});
}
int main() {
int a = 3;
G(a);
}
```
Output:
<source>: In lambda function:
<source>:9:43: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3426
9 | decltype(auto) y = ({ decltype(x) z = x; z + 0; });
| ^
0x291bd58 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x2910b1b internal_error(char const*, ...)
???:0
0xb13b26 fancy_abort(char const*, int, char const*)
???:0
0x11c0fef gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c0d2a gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c45ea gimplify_stmt(tree_node**, gimple**)
???:0
0x11c25d1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c1a47 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c45ea gimplify_stmt(tree_node**, gimple**)
???:0
0x11c139b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c1a47 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c45ea gimplify_stmt(tree_node**, gimple**)
???:0
0x11c139b gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c45ea gimplify_stmt(tree_node**, gimple**)
???:0
0x11c1870 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11c45ea gimplify_stmt(tree_node**, gimple**)
???:0
0x11c1870 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0x11e5a96 gimplify_body(tree_node*, bool)
???:0
0x11e5f5c gimplify_function_tree(tree_node*)
???:0
0xf9cf67 cgraph_node::analyze()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1