]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR tree-optimization/110531 - Vect: avoid using uninitialized variable
authorHao Liu <hliu@os.amperecomputing.com>
Tue, 4 Jul 2023 09:17:50 +0000 (17:17 +0800)
committerHao Liu <hliu@os.amperecomputing.com>
Tue, 4 Jul 2023 09:19:23 +0000 (17:19 +0800)
slp_done_for_suggested_uf is used directly in vect_analyze_loop_2
without initialization, which is undefined behavior.  Initialize it to false
according to the discussion.

gcc/ChangeLog:
PR tree-optimization/110531
* tree-vect-loop.cc (vect_analyze_loop_1): initialize
slp_done_for_suggested_uf to false.

gcc/tree-vect-loop.cc

index f39a1ecb306330a246a12144f0e45b34a05b107a..e504645f1dfa2fb178b5faf6cbda293a7a274d50 100644 (file)
@@ -3333,7 +3333,7 @@ vect_analyze_loop_1 (class loop *loop, vec_info_shared *shared,
   machine_mode vector_mode = vector_modes[mode_i];
   loop_vinfo->vector_mode = vector_mode;
   unsigned int suggested_unroll_factor = 1;
-  bool slp_done_for_suggested_uf;
+  bool slp_done_for_suggested_uf = false;
 
   /* Run the main analysis.  */
   opt_result res = vect_analyze_loop_2 (loop_vinfo, fatal,