https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111355
Bug ID: 111355
Summary: ICE on valid code at -O1 and above: in lower_bound, at
value-range.h:1078
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: zhendong.su at inf dot ethz.ch
Target Milestone: ---
This appears to be a recent regression.
Compiler Explorer: https://godbolt.org/z/rPvxdPsE4
[519] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--enable-checking=yes --prefix=/local/suz-local/software/local/gcc-trunk
--enable-sanitizers --enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 20230909 (experimental) (GCC)
[520] %
[520] % gcctk -O1 -w small.c
during GIMPLE pass: ccp
small.c: In function ‘main’:
small.c:4:1: internal compiler error: in lower_bound, at value-range.h:1078
4 | }
| ^
0xd3617e irange::lower_bound(unsigned int) const
../../gcc-trunk/gcc/value-range.h:1078
0xd3617e irange::lower_bound(unsigned int) const
../../gcc-trunk/gcc/value-range.h:1076
0x161e375 gimple_simplify_TRUNC_DIV_EXPR(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), code_helper, tree_node*, tree_node*, tree_node*)
/local/suz-local/software/gccbuild/objdir/gcc/gimple-match-7.cc:8473
0x173a4c6 gimple_resimplify2
../../gcc-trunk/gcc/gimple-match-exports.cc:1001
0x173af60 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-match-exports.cc:868
0xca44fc gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-fold.cc:7545
0x112da22 ccp_fold
../../gcc-trunk/gcc/tree-ssa-ccp.cc:1288
0x112da22 evaluate_stmt
../../gcc-trunk/gcc/tree-ssa-ccp.cc:2225
0x112f3f5 visit_assignment
../../gcc-trunk/gcc/tree-ssa-ccp.cc:2859
0x11e2f1a ssa_propagation_engine::simulate_stmt(gimple*)
../../gcc-trunk/gcc/tree-ssa-propagate.cc:221
0x11e322a ssa_propagation_engine::simulate_block(basic_block_def*)
../../gcc-trunk/gcc/tree-ssa-propagate.cc:328
0x11e3633 ssa_propagation_engine::ssa_propagate()
../../gcc-trunk/gcc/tree-ssa-propagate.cc:478
0x1125230 do_ssa_ccp
../../gcc-trunk/gcc/tree-ssa-ccp.cc:2978
0x1125230 execute
../../gcc-trunk/gcc/tree-ssa-ccp.cc:3024
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.
[521] %
[521] % cat small.c
int main() {
unsigned b;
return b ? 1 << --b / 0 : 0;
}