https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127579
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <[email protected]>: https://gcc.gnu.org/g:2b7ddfb841114b2783f0b3420fcb96e7687484d9 commit r17-4625-g2b7ddfb841114b2783f0b3420fcb96e7687484d9 Author: Tamar Christina <[email protected]> Date: Thu Sep 24 10:03:51 2026 +0100 vect: fix emulated vector costing [PR127579] The testcase char a; int b; void e() { char *c = (char *)&b; int d = 0; for (; d < b; d++) a += c[d]; } ICEs with -O2 -mgeneral-regs-only -march=armv9-a with a segfault in single cycle detection: internal compiler error: Segmentation fault // 446 | ff_layout_alloc_lseg(struct pnfs_layout_hdr *lh, // | ^~~~~~~~~~~~~~~~~~~~ // 0xf3fc23 internal_error(char const*, ...) // ../../src/gcc/diagnostic-global-context.cc:787 // 0x976543 crash_signal // ../../src/gcc/toplev.cc:325 // 0x1e43f74 info_for_reduction(_loop_vec_info*, _slp_tree*) // ../../src/gcc/tree-vect-loop.cc:5060 // 0x1a7946f aarch64_force_single_cycle // ../../src/gcc/config/aarch64/aarch64.cc:18284 This is because the slp_node is null and so looking up the reduction info fails. With -mgeneral-regs the SIMD reduction instructions become unavailable, so the vectorizer tries to emulate them. This enters a branch in vectorizable_operation where it looks like we forgot to update the costing code from using stmt_vinfo to the slp_node during the SLP only costing transition. As such it uses the old interface which does not provide the required SLP node and we ICE. The fix is to use the slp_node instead of the stmt_info. gcc/ChangeLog: PR tree-optimization/127579 * tree-vect-loop.cc (info_for_reduction): Add assert. * tree-vect-stmts.cc (vectorizable_operation): Pass SLP node. gcc/testsuite/ChangeLog: PR tree-optimization/127579 * gcc.target/aarch64/pr127579.c: New test.
