https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107109
--- Comment #1 from Zhendong Su <zhendong.su at inf dot ethz.ch> ---
Another test that only reproduces at -O2 and -O3.
[508] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/13.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
--with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.0 20221002 (experimental) [master r13-3015-g3290dcf1499] (GCC)
[509] %
[509] % gcctk -O1 small.c; ./a.out
[510] %
[510] % gcctk -O2 small.c
during GIMPLE pass: dom
small.c: In function ‘main’:
small.c:2:5: internal compiler error: in type, at value-range.h:621
2 | int main() {
| ^~~~
0x85dab4 irange::type() const
../../gcc-trunk/gcc/value-range.h:621
0x85e731 irange::type() const
../../gcc-trunk/gcc/tree.h:3634
0x85e731 adjust_op1_for_overflow
../../gcc-trunk/gcc/range-op.cc:1373
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1414
0x1de43e3 operator_plus::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1400
0x1de43e3 operator_plus::op2_range(irange&, tree_node*, irange const&, irange
const&, relation_kind_t) const
../../gcc-trunk/gcc/range-op.cc:1424
0x1ce8e58 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1182
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ce8ed0 gori_compute::compute_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1228
0x1ce7435 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:694
0x1ce7209 gori_compute::compute_logical_operands(vrange&, vrange&,
gimple_range_op_handler&, irange const&, tree_node*, fur_source&, tree_node*,
bool)
../../gcc-trunk/gcc/gimple-range-gori.cc:913
0x1ce7aae gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:674
0x1ce85df gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:1140
0x1ce7bdd gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
../../gcc-trunk/gcc/gimple-range-gori.cc:692
0x1ceafd8 gori_compute::outgoing_edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
../../gcc-trunk/gcc/gimple-range-gori.cc:1358
0x10a218d path_range_query::compute_ranges_in_block(basic_block_def*)
../../gcc-trunk/gcc/gimple-range-path.cc:454
0x10a2882 path_range_query::compute_ranges(bitmap_head const*)
../../gcc-trunk/gcc/gimple-range-path.cc:622
0x112dd90 hybrid_jt_simplifier::simplify(gimple*, gimple*, basic_block_def*,
jt_state*)
../../gcc-trunk/gcc/tree-ssa-threadedge.cc:1418
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.
[511] %
[511] % cat small.c
int a, b = 1, c;
int main() {
if (b <= 0) {
if (a)
L:
if (b && a <= 600000000)
b = c;
int e = ~(a + b);
if ((b <= e || a > e) && a)
a = 0;
if (b < 0)
goto L;
if (b >= a)
while (1)
;
}
return 0;
}