https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124648
Bug ID: 124648
Summary: ICE, contracts: precondition on lambda
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ivan.lazaric.gcc at gmail dot com
Target Milestone: ---
```cpp
int main() {
int a = 0;
int b = 3;
auto lambda = [&] pre(a < b) {};
lambda();
}
```
Trunk compiler
Flags: -std=c++26 -fcontracts
Compiler output:
```
epoll_bug.cpp: In lambda function:
epoll_bug.cpp:4:27: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.cc:3426
4 | auto lambda = [&] pre(a < b) {};
| ~~^~~
0x21f854b internal_error(char const*, ...)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/diagnostic-global-context.cc:787
0x7af099 fancy_abort(char const*, int, char const*)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/diagnostics/context.cc:1823
0x778aff gimplify_var_or_parm_decl
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:3426
0xd398b7 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20946
0xd3a800 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20600
0xd394c1 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:21304
0xd47ce0 gimplify_cond_expr
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:5673
0xd3aabf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20433
0xd4cae8 gimplify_stmt(tree_node**, gimple**)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8679
0xd4cae8 gimplify_bind_expr
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:1689
0xd39d2f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20680
0xd3a4e5 gimplify_stmt(tree_node**, gimple**)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8679
0xd3a4e5 gimplify_statement_list
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:2294
0xd3a4e5 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:20930
0xd3eeff gimplify_stmt(tree_node**, gimple**)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:8679
0xd3eeff gimplify_body(tree_node*, bool)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:21786
0xd3f319 gimplify_function_tree(tree_node*)
/home/ilazaric/repos/ALL/submodules/gcc/gcc/gimplify.cc:21995
0xb5e537 cgraph_node::analyze()
/home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:691
0xb60b67 analyze_functions
/home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:1270
0xb61826 symbol_table::finalize_compilation_unit()
/home/ilazaric/repos/ALL/submodules/gcc/gcc/cgraphunit.cc:2593
/opt/GCC/libexec/gcc/x86_64-pc-linux-gnu/16.0.1/cc1plus -quiet -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE epoll_bug.cpp -quiet -dumpdir a- -dumpbase
epoll_bug.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -std=c++26
-fcontracts -o /tmp/ccsXFJYm.s
```
Godbolt of example: https://godbolt.org/z/3sG7MbTMv