re PR tree-optimization/86287 (AddressSanitizer: heap-use-after-free on bootstrap...
authorRichard Biener <rguenther@suse.de>
Tue, 26 Jun 2018 06:42:46 +0000 (06:42 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 26 Jun 2018 06:42:46 +0000 (06:42 +0000)
2018-06-26  Richard Biener  <rguenther@suse.de>

PR tree-optimization/86287
PR bootstrap/86316
* tree-vect-loop.c (vect_transform_loop_stmt): Fix read-after-free.
(vect_analyze_loop): Initialize n_stmts.

From-SVN: r262132

gcc/ChangeLog
gcc/tree-vect-loop.c

index 342c69b124073ad17688d3e6e8e86da1a130c0c3..ec68212bc0af4ad1f07a49c6b4ad4776ce84ba17 100644 (file)
@@ -1,3 +1,10 @@
+2018-06-26  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/86287
+       PR bootstrap/86316
+       * tree-vect-loop.c (vect_transform_loop_stmt): Fix read-after-free.
+       (vect_analyze_loop): Initialize n_stmts.
+
 2018-06-26  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/86271
index dacc8811636a34140ca61838a1c0bb71e53e3c96..615b6bb101f411bf89be4691e3cddc0610cc1bcb 100644 (file)
@@ -2315,7 +2315,7 @@ vect_analyze_loop (struct loop *loop, loop_vec_info orig_loop_vinfo,
       return NULL;
     }
 
-  unsigned n_stmts;
+  unsigned n_stmts = 0;
   poly_uint64 autodetected_vector_size = 0;
   while (1)
     {
@@ -8342,8 +8342,9 @@ vect_transform_loop_stmt (loop_vec_info loop_vinfo, gimple *stmt,
 
   /* SLP.  Schedule all the SLP instances when the first SLP stmt is
      reached.  */
-  if (STMT_SLP_TYPE (stmt_info))
+  if (slp_vect_type slptype = STMT_SLP_TYPE (stmt_info))
     {
+
       if (!*slp_scheduled)
        {
          *slp_scheduled = true;
@@ -8354,7 +8355,7 @@ vect_transform_loop_stmt (loop_vec_info loop_vinfo, gimple *stmt,
        }
 
       /* Hybrid SLP stmts must be vectorized in addition to SLP.  */
-      if (PURE_SLP_STMT (stmt_info))
+      if (slptype == pure_slp)
        return;
     }