https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110531
Kewen Lin <linkw at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #1 from Kewen Lin <linkw at gcc dot gnu.org> --- (In reply to Hao Liu from comment #0) > This seems an obvious bug in tree-vect-loop.cc: > > (1) This var is declared (but not initialized) and used in function > vect_analyze_loop_1: > > bool slp_done_for_suggested_uf; <---- Warning, this is not > initialized > > /* Run the main analysis. */ > opt_result res = vect_analyze_loop_2 (loop_vinfo, fatal, > &suggested_unroll_factor, > slp_done_for_suggested_uf); > > (2) It is used before set in function vect_analyze_loop_2: > static opt_result > vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal, > unsigned *suggested_unroll_factor, > bool& slp_done_for_suggested_uf) > ... > bool slp = !applying_suggested_uf || slp_done_for_suggested_uf; <--- used > without initialized > ... > slp_done_for_suggested_uf = slp; > > > I don't know the detail logic and wonder if it should be initialized as > "true" or "false" (probably it should be "false"). Is the warning from some static analyzer? This behavior was intentional, in the first time to call vect_analyze_loop_2, we have loop_vinfo->suggested_unroll_factor = 1, applying_suggested_uf would be false always, it means that at the below place bool slp = !applying_suggested_uf || slp_done_for_suggested_uf; slp should be true always (always do analyze slp), it doesn't care what's in slp_done_for_suggested_uf. For a successful analysis, we would definitely do: slp_done_for_suggested_uf = slp; So in the 2nd call to vect_analyze_loop_2, slp_done_for_suggested_uf should get assigned by expected valu (should not be uninitialized).