From: Hao Liu Date: Tue, 4 Jul 2023 09:17:50 +0000 (+0800) Subject: PR tree-optimization/110531 - Vect: avoid using uninitialized variable X-Git-Tag: basepoints/gcc-15~7849 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2c12ccf800fc7890925402d30a02f0fa9e2627cc;p=thirdparty%2Fgcc.git PR tree-optimization/110531 - Vect: avoid using uninitialized variable 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. --- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index f39a1ecb3063..e504645f1dfa 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -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,