public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hao Liu OS <hliu@os.amperecomputing.com>
To: "GCC-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [PATCH] Vect: avoid using uninitialized variable (PR tree-optimization/110531)
Date: Tue, 4 Jul 2023 08:51:00 +0000	[thread overview]
Message-ID: <SJ2PR01MB863509CEB9A5B18AD42D986EE12EA@SJ2PR01MB8635.prod.exchangelabs.com> (raw)

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

             reply	other threads:[~2023-07-04  8:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04  8:51 Hao Liu OS [this message]
2023-07-04  8:58 ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ2PR01MB863509CEB9A5B18AD42D986EE12EA@SJ2PR01MB8635.prod.exchangelabs.com \
    --to=hliu@os.amperecomputing.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).