https://gcc.gnu.org/g:6307c8dcb33a391daeafd03e7239f41affde5648

commit r17-3991-g6307c8dcb33a391daeafd03e7239f41affde5648
Author: Richard Biener <[email protected]>
Date:   Tue Sep 8 12:04:40 2026 +0200

    tree-optimization/127245 - fix another ICE in vect_create_constant_vectors
    
    There's a mismatch in the node checked (oops) in
    vect_slp_analyze_node_operations causing a later ICE.
    
            PR tree-optimization/127245
            * tree-vect-slp.cc (vect_slp_analyze_node_operations): Check
            whether child passes vect_get_num_copies_for_invariant.
    
            * gcc.dg/vect/vect-pr127245.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/vect/vect-pr127245.c | 13 +++++++++++++
 gcc/tree-vect-slp.cc                      |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/vect/vect-pr127245.c 
b/gcc/testsuite/gcc.dg/vect/vect-pr127245.c
new file mode 100644
index 000000000000..6812642629cd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-pr127245.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=armv8.3-a+sve" { target aarch64-*-* } } */
+
+struct vbi_char {
+  unsigned bold : 1;
+  unsigned : 16;
+} ;
+struct vbi_char *v;
+void f(int l, bool bold)
+{
+  for (int i = 0; i < l; i++)
+    v[i].bold = bold;
+}
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 9a2bf07514c8..eee02124d5ba 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -9127,7 +9127,7 @@ vect_slp_analyze_node_operations (vec_info *vinfo, 
slp_tree node,
 
          /* Make sure we can generate them and then cost them.  */
          unsigned nvectors, excess_elts;
-         if (!vect_get_num_copies_for_invariant (vinfo, node, &nvectors,
+         if (!vect_get_num_copies_for_invariant (vinfo, child, &nvectors,
                                                  &excess_elts))
            return false;
          vect_prologue_cost_for_slp (child, nvectors, cost_vec);

Reply via email to