https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100349
Bug ID: 100349
Summary: [11/12 Regression] ICE Segmentation fault during
GIMPLE pass: evrp (under -O2 to -Os)
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: haoxintu at gmail dot com
Target Milestone: ---
Hi, all.
$cat small.c
#include <stdint.h>
uint8_t a;
b(int8_t c) {
int d;
e:
uint32_t f;
for (;;)
for (c = 10; c; c++)
if (0 > (a = c) ?: d) {
f = a;
goto e;
}
}
$gcc -w -O2 small.c
during GIMPLE pass: evrp
small.c: In function ‘b’:
small.c:13:1: internal compiler error: Segmentation fault
13 | }
| ^
0xb9ec1f crash_signal
../../gcc/toplev.c:327
0xe5a92b bounds_of_var_in_loop(tree_node**, tree_node**, range_query*, loop*,
gimple*, tree_node*)
../../gcc/vr-values.c:1658
0x146fa91 gimple_ranger::range_of_ssa_name_with_loop_info(irange&, tree_node*,
loop*, gphi*)
../../gcc/gimple-range.cc:1220
0x146fd83 gimple_ranger::range_of_phi(irange&, gphi*)
../../gcc/gimple-range.cc:568
0x147017d gimple_ranger::calc_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:376
0x14704a1 gimple_ranger::range_of_stmt(irange&, gimple*, tree_node*)
../../gcc/gimple-range.cc:1068
0x146c040 gimple_ranger::range_of_expr(irange&, tree_node*, gimple*)
../../gcc/gimple-range.cc:960
0xe1a0e1 range_query::value_of_expr(tree_node*, gimple*)
../../gcc/value-query.cc:86
0x147a6f1 hybrid_folder::value_of_expr(tree_node*, gimple*)
../../gcc/gimple-ssa-evrp.c:235
0xcf836d substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1072
0x14482d7 dom_walker::walk(basic_block_def*)
../../gcc/domwalk.c:309
0xcf7a35 substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
../../gcc/tree-ssa-propagate.c:1283
0x147a366 execute_early_vrp
../../gcc/gimple-ssa-evrp.c:349
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/tuhaoxin/compilers/gcc/build-20210425/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/tuhaoxin/compilers/gcc/build-20210425/ --enable-bootstrap
--enable-checking=release --enable-languages=c,c++ --enable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210425 (experimental) (GCC)
This issue may start from one of the commits in GCC-11, and it's performed well
in released GCC-10.3.0 downwards versions.
Another weird behavior is that this code is accepted under -O1 in GCC-11 and
GCC-12 while rejected in other released GCC versions. I guess there might be a
problem here?
Reproduced in Godbolt: https://godbolt.org/z/E7K9Ghjcc
Thanks
Haoxin