public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-1713] tree-optimization/101154 - fix out-of bound access in SLP
@ 2021-06-22  9:01 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-06-22  9:01 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:26f05f5a823030ebb52b107a8c303d07f77fe317

commit r12-1713-g26f05f5a823030ebb52b107a8c303d07f77fe317
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Jun 22 09:10:56 2021 +0200

    tree-optimization/101154 - fix out-of bound access in SLP
    
    This fixes an out-of-bound access of matches.
    
    2021-06-22  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/101154
            * tree-vect-slp.c (vect_build_slp_tree_2): Fix out-of-bound access.

Diff:
---
 gcc/tree-vect-slp.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index a32f86b8bc7..b9f91e7c7ba 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1963,15 +1963,15 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
 	      if (dt == vect_constant_def
 		  || dt == vect_external_def)
 		{
-		/* We can always build those.  Might want to sort last
-		   or defer building.  */
-		   vec<tree> ops;
-		   ops.create (group_size);
-		   for (lane = 0; lane < group_size; ++lane)
-		     ops.quick_push (chains[lane][n].op);
-		   slp_tree child = vect_create_new_slp_node (ops);
-		   SLP_TREE_DEF_TYPE (child) = dt;
-		   children.safe_push (child);
+		  /* We can always build those.  Might want to sort last
+		     or defer building.  */
+		  vec<tree> ops;
+		  ops.create (group_size);
+		  for (lane = 0; lane < group_size; ++lane)
+		    ops.quick_push (chains[lane][n].op);
+		  slp_tree child = vect_create_new_slp_node (ops);
+		  SLP_TREE_DEF_TYPE (child) = dt;
+		  children.safe_push (child);
 		}
 	      else if (dt != vect_internal_def)
 		{
@@ -2036,9 +2036,10 @@ vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
 			dump_printf_loc (MSG_NOTE, vect_location,
 					 "failed to match up op %d\n", n);
 		      op_stmts.release ();
-		      matches[lane] = false;
 		      if (lane != group_size - 1)
 			matches[0] = false;
+		      else
+			matches[lane] = false;
 		      goto out;
 		    }
 		  if (dump_enabled_p ())


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-22  9:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22  9:01 [gcc r12-1713] tree-optimization/101154 - fix out-of bound access in SLP Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).