https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125699
--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
A related ICE that only triggers at -Os and -O2 with "-g -fwhole-program", but
not -O3:
[527] % 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/17.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 17.0.0 20260609 (experimental) (GCC)
[528] %
[528] % for i in $(seq 1 10); do echo $i; gcctk -O2 -g -fwhole-program small.c;
done
1
2
3
4
5
6
7
8
9
10
[529] % for i in $(seq 1 10); do echo $i; gcctk -O2 -g -fwhole-program small.c;
done
1
2
3
4
5
unhandled expression in get_expr_operands():
<<invalid tree code> 0x7f2c94536ce0>
during IPA pass: inline
In function ‘d.isra’:
cc1: internal compiler error: in get_expr_operands, at tree-ssa-operands.cc:943
0x265e5ab internal_error(char const*, ...)
../../gcc-trunk/gcc/diagnostic-global-context.cc:787
0xa2f89c fancy_abort(char const*, int, char const*)
../../gcc-trunk/gcc/diagnostics/context.cc:1813
0x13effbd operands_scanner::get_expr_operands(tree_node**, int)
../../gcc-trunk/gcc/tree-ssa-operands.cc:943
0x13f146f operands_scanner::build_ssa_operands()
../../gcc-trunk/gcc/tree-ssa-operands.cc:1014
0x13f1594 update_stmt_operands(function*, gimple*)
../../gcc-trunk/gcc/tree-ssa-operands.cc:1156
0xdec63f update_stmt_if_modified(gimple*)
../../gcc-trunk/gcc/gimple-ssa.h:187
0xdec63f update_stmt_if_modified(gimple*)
../../gcc-trunk/gcc/gimple-ssa.h:184
0xdec63f update_modified_stmt
../../gcc-trunk/gcc/gimple-iterator.cc:53
0xdec63f gsi_insert_after(gimple_stmt_iterator*, gimple*, gsi_iterator_update)
../../gcc-trunk/gcc/gimple-iterator.cc:555
0x1292f8e copy_bb
../../gcc-trunk/gcc/tree-inline.cc:2131
0x12948ff copy_cfg_body
../../gcc-trunk/gcc/tree-inline.cc:3154
0x12948ff copy_body
../../gcc-trunk/gcc/tree-inline.cc:3409
0x129750b tree_function_versioning(tree_node*, tree_node*,
vec<ipa_replace_map*, va_gc, vl_embed>*, ipa_param_adjustments*, bool,
bitmap_head*, basic_block_def*)
../../gcc-trunk/gcc/tree-inline.cc:6521
0xc686cd cgraph_node::materialize_clone()
../../gcc-trunk/gcc/cgraphclones.cc:1249
0xc550fd cgraph_node::get_untransformed_body()
../../gcc-trunk/gcc/cgraph.cc:4601
0xf25065 maybe_materialize_called_clones
../../gcc-trunk/gcc/ipa-inline-transform.cc:790
0xf26d3e inline_transform(cgraph_node*)
../../gcc-trunk/gcc/ipa-inline-transform.cc:848
0x10bc4ee execute_one_ipa_transform_pass
../../gcc-trunk/gcc/passes.cc:2327
0x10bc4ee execute_all_ipa_transforms(bool)
../../gcc-trunk/gcc/passes.cc:2390
0xc62360 cgraph_node::expand()
../../gcc-trunk/gcc/cgraphunit.cc:1867
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -I /usr/local/include -I /local/suz-local/software/local/include
-imultiarch x86_64-linux-gnu -iprefix
/local/home/suz/suz-local/software/local/gcc-trunk/bin/../lib/gcc/x86_64-pc-linux-gnu/17.0.0/
small.c -quiet -dumpdir a- -dumpbase small.c -dumpbase-ext .c -mtune=generic
-march=x86-64 -g -O2 -fwhole-program -o /tmp/ccwjk3dF.s
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.
6
7
8
9
10
[530] %
[530] % cat small.c
char a, k;
int b, c;
int d(char e, char f) {
char g;
int h, i;
l:
g = h = ((long)f << 6 >> 6) - c;
if (b)
goto j;
if (c)
goto l;
j:
i = (long)g + h;
i = e + i;
return i;
}
int main() { d(k, a); }