https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109115
Bug ID: 109115 Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu: in upper_bound, at value-range.h:950 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: --- It appears to be a recent regression as it does not reproduce with 12.2. Compiler Explorer: https://godbolt.org/z/Yjaj5qMvv [569] % 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.1/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.1 20230313 (experimental) [master r13-6641-g23532dac3f6] (GCC) [570] % [570] % gcctk -Os small.c; ./a.out [571] % [571] % gcctk -O2 small.c during GIMPLE pass: slp small.c: In function ‘main’: small.c:2:5: internal compiler error: in upper_bound, at value-range.h:950 2 | int main() { | ^~~~ 0xc48c63 irange::upper_bound() const ../../gcc-trunk/gcc/value-range.h:950 0xc48c63 irange::upper_bound() const ../../gcc-trunk/gcc/value-range.h:947 0x1e9e7ca vect_recog_divmod_pattern ../../gcc-trunk/gcc/tree-vect-patterns.cc:3978 0x1e9808a vect_pattern_recog_1 ../../gcc-trunk/gcc/tree-vect-patterns.cc:6244 0x1e9d3c1 vect_pattern_recog(vec_info*) ../../gcc-trunk/gcc/tree-vect-patterns.cc:6401 0x11a97dc vect_slp_analyze_bb_1 ../../gcc-trunk/gcc/tree-vect-slp.cc:7310 0x11a97dc vect_slp_region ../../gcc-trunk/gcc/tree-vect-slp.cc:7419 0x11abac3 vect_slp_bbs ../../gcc-trunk/gcc/tree-vect-slp.cc:7610 0x11abe9c vect_slp_function(function*) ../../gcc-trunk/gcc/tree-vect-slp.cc:7698 0x11b6492 execute ../../gcc-trunk/gcc/tree-vectorizer.cc:1532 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. [572] % [572] % cat small.c int a, b; int main() { unsigned short c = a, e = -1; if (b) { unsigned d = (a ^ 1U) / a & c; int f = (~d >> ~a) / e; if (a) f = a; a = f; } return 0; }