https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121035
Bug ID: 121035 Summary: ICE on valid code at -O{2,3} with "-fno-tree-dce -fno-tree-dse -fno-expensive-optimizations -fno-ssa-phiopt" on x86_64-linux-gnu: Segmentation fault 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/9dcozz6ov It appears to be a regression from 14.3 and affects 15.1 and trunk. [606] % 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 20250711 (experimental) (GCC) [607] % [607] % gcctk -O3 -fno-tree-dce -fno-tree-dse -fno-expensive-optimizations -fno-ssa-phiopt small.c during GIMPLE pass: pre small.c: In function ‘main’: small.c:4:5: internal compiler error: Segmentation fault 4 | int main() { | ^~~~ 0x255ccb6 internal_error(char const*, ...) ../../gcc-trunk/gcc/diagnostic-global-context.cc:517 0x119d693 crash_signal ../../gcc-trunk/gcc/toplev.cc:321 0x7f68bd42151f ??? ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0 0x139c744 bmp_iter_set_init(bitmap_iterator*, bitmap_head const*, unsigned int, unsigned int*) ../../gcc-trunk/gcc/bitmap.h:542 0x139c744 find_or_generate_expression ../../gcc-trunk/gcc/tree-ssa-pre.cc:2776 0x139bd5a find_or_generate_expression ../../gcc-trunk/gcc/tree-ssa-pre.cc:2748 0x139bd5a create_expression_by_pieces ../../gcc-trunk/gcc/tree-ssa-pre.cc:2924 0x13a0cf3 insert_into_preds_of_block ../../gcc-trunk/gcc/tree-ssa-pre.cc:3132 0x13a3710 do_pre_regular_insertion ../../gcc-trunk/gcc/tree-ssa-pre.cc:3398 0x13a3710 insert ../../gcc-trunk/gcc/tree-ssa-pre.cc:3833 0x13a3710 execute ../../gcc-trunk/gcc/tree-ssa-pre.cc:4497 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. [608] % [608] % cat small.c int printf(const char *, ...); int a, b, d; unsigned c; int main() { int f = 0; while (a) { unsigned g = c; if (f) printf("0"); ~(c << 1); b = ~-(a * d && 1) | g * -2 && a; f = c; } return 0; }