https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123530
Bug ID: 123530
Summary: ICE on valid code at -O1 and above on
x86_64-linux-gnu: in tree_to_uhwi, at tree.cc:6681
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: ---
Compiler Explorer: https://godbolt.org/z/fdeK1fPhh
Note:
- fails: trunk
- works: 15.2 and earlier
[511] % 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/16.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 16.0.0 20260111 (experimental) (GCC)
[512] %
[512] % gcctk -O1 -c small.c
during GIMPLE pass: ccp
small.c: In function ādā:
small.c:5:1: internal compiler error: in tree_to_uhwi, at tree.cc:6681
5 | }
| ^
0x25c36ab internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa1e9a2 fancy_abort(char const*, int, char const*)
../../gcc-trunk/gcc/diagnostics/context.cc:1805
0x9253c9 tree_to_uhwi(tree_node const*)
../../gcc-trunk/gcc/tree.cc:6681
0x9253c9 tree_to_uhwi(tree_node const*)
../../gcc-trunk/gcc/tree.cc:6679
0x178f358 gimple_simplify_187(gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node*, tree_node**)
/local/suz-local/software/gccbuild/objdir/gcc/gimple-match-2.cc:4043
0x19d8d93 gimple_simplify_BIT_IOR_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:42926
0x1b27336 gimple_resimplify2
../../gcc-trunk/gcc/gimple-match-exports.cc:1027
0x1b27dd0 gimple_simplify(gimple*, gimple_match_op*, gimple**, tree_node*
(*)(tree_node*), tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-match-exports.cc:894
0xdedb32 gimple_fold_stmt_to_constant_1(gimple*, tree_node* (*)(tree_node*),
tree_node* (*)(tree_node*))
../../gcc-trunk/gcc/gimple-fold.cc:9496
0x1321f72 ccp_fold
../../gcc-trunk/gcc/tree-ssa-ccp.cc:1304
0x1321f72 evaluate_stmt
../../gcc-trunk/gcc/tree-ssa-ccp.cc:2267
0x1323faf visit_assignment
../../gcc-trunk/gcc/tree-ssa-ccp.cc:2907
0x13e9b8a ssa_propagation_engine::simulate_stmt(gimple*)
../../gcc-trunk/gcc/tree-ssa-propagate.cc:221
0x13e9e9a ssa_propagation_engine::simulate_block(basic_block_def*)
../../gcc-trunk/gcc/tree-ssa-propagate.cc:328
0x13ea2a3 ssa_propagation_engine::ssa_propagate()
../../gcc-trunk/gcc/tree-ssa-propagate.cc:478
0x1319e81 do_ssa_ccp
../../gcc-trunk/gcc/tree-ssa-ccp.cc:3026
0x1319e81 execute
../../gcc-trunk/gcc/tree-ssa-ccp.cc:3072
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.
[513] %
[513] % cat small.c
int a, b, c;
void d() {
int e = -1;
(c >> e | ~(b << 1) ^ 1) & a;
}