https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115197
Bug ID: 115197 Summary: ICE on valid code at -O{1,2} with "-fno-tree-scev-cprop -ftree-pre -ftree-loop-distribute-patterns" 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: --- It appears to be a regression from 12.*, and affects 13.* and later. Compiler Explorer: https://godbolt.org/z/aGqYsMjTv [520] % 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/15.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 15.0.0 20240522 (experimental) (GCC) [521] % [521] % gcctk -O1 -fno-tree-scev-cprop -ftree-pre -ftree-loop-distribute-patterns small.c during GIMPLE pass: ldist small.c: In function ‘main’: small.c:2:5: internal compiler error: tree check: expected tree that contains ‘decl minimal’ structure, have ‘integer_cst’ in get_var_info, at tree-into-ssa.cc:362 2 | int main() { | ^~~~ 0x8c8f2f tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-trunk/gcc/tree.cc:9169 0x86647a contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) ../../gcc-trunk/gcc/tree.h:3770 0x86647a get_var_info ../../gcc-trunk/gcc/tree-into-ssa.cc:362 0x86647a get_var_info ../../gcc-trunk/gcc/tree-into-ssa.cc:357 0x121a013 get_common_info ../../gcc-trunk/gcc/tree-into-ssa.cc:395 0x121a013 get_current_def(tree_node*) ../../gcc-trunk/gcc/tree-into-ssa.cc:404 0x122b69e copy_loop_before ../../gcc-trunk/gcc/tree-loop-distribution.cc:980 0x122b69e generate_loops_for_partition ../../gcc-trunk/gcc/tree-loop-distribution.cc:1020 0x122b69e generate_code_for_partition ../../gcc-trunk/gcc/tree-loop-distribution.cc:1381 0x122b69e loop_distribution::distribute_loop(loop*, vec<gimple*, va_heap, vl_ptr> const&, control_dependences*, int*, bool*, bool) ../../gcc-trunk/gcc/tree-loop-distribution.cc:3256 0x122be69 loop_distribution::execute(function*) ../../gcc-trunk/gcc/tree-loop-distribution.cc:3925 0x122cc0f execute ../../gcc-trunk/gcc/tree-loop-distribution.cc:4013 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. [522] % [522] % cat small.c int a, b[2], c, d, e, f[2]; int main() { while (a) if (d) { if (e) return 0; for (; c; c++) f[c] = 0 < (b[c] = ~(f[c + 1] < a)); } return 0; }