public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Vect: avoid using uninitialized variable (PR tree-optimization/110531)
@ 2023-07-04  8:51 Hao Liu OS
  2023-07-04  8:58 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Hao Liu OS @ 2023-07-04  8:51 UTC (permalink / raw)
  To: GCC-patches@gcc.gnu.org

slp_done_for_suggested_uf is used 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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index f39a1ecb306..e504645f1df 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,
-- 
2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Vect: avoid using uninitialized variable (PR tree-optimization/110531)
  2023-07-04  8:51 [PATCH] Vect: avoid using uninitialized variable (PR tree-optimization/110531) Hao Liu OS
@ 2023-07-04  8:58 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2023-07-04  8:58 UTC (permalink / raw)
  To: Hao Liu OS; +Cc: GCC-patches@gcc.gnu.org

On Tue, Jul 4, 2023 at 10:51 AM Hao Liu OS via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> slp_done_for_suggested_uf is used in vect_analyze_loop_2 without
> initialization, which is undefined behavior.  Initialize it to false
> according to the discussion.

OK

> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index f39a1ecb306..e504645f1df 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,
> --
> 2.34.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-07-04  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-04  8:51 [PATCH] Vect: avoid using uninitialized variable (PR tree-optimization/110531) Hao Liu OS
2023-07-04  8:58 ` Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).