This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR63665


It seems that SLP vectorization can somehow generate out-of-bound
masks for VEC_PERM.  The following fixes that (the ICE reproduces
on x86_64 with the added assert).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2014-10-28  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/63665
	* tree-vect-slp.c (vect_get_mask_element): Properly handle
	accessing out-of-bound elements.

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c	(revision 216771)
+++ gcc/tree-vect-slp.c	(working copy)
@@ -2890,7 +2890,7 @@ vect_get_mask_element (gimple stmt, int
     }
 
   /* The mask requires the next vector.  */
-  if (*current_mask_element >= mask_nunits * 2)
+  while (*current_mask_element >= mask_nunits * 2)
     {
       if (*needs_first_vector || *mask_fixed)
         {
@@ -3041,6 +3041,7 @@ vect_transform_slp_perm_load (slp_tree n
 					  &number_of_mask_fixes, &mask_fixed,
 					  &needs_first_vector))
 		return false;
+	      gcc_assert (current_mask_element < 2 * nunits);
 	      mask[index++] = current_mask_element;
 
               if (index == nunits)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]