public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vineetg@rivosinc.com>
To: gcc-patches@gcc.gnu.org
Cc: Jeff Law <jeffreyalaw@gmail.com>,
	kito.cheng@gmail.com, Palmer Dabbelt <palmer@rivosinc.com>,
	Robin Dapp <rdapp.gcc@gmail.com>,
	gnu-toolchain@rivosinc.com, Vineet Gupta <vineetg@rivosinc.com>,
	Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 3/3] combine: initialize a local var
Date: Thu,  2 May 2024 11:59:24 -0700	[thread overview]
Message-ID: <20240502185924.2060196-4-vineetg@rivosinc.com> (raw)
In-Reply-To: <20240502185924.2060196-1-vineetg@rivosinc.com>

This is no logic change (but technically still a functional change).

Ran into this when stepping thru combine code.
@newpat has some random garbage for a bit until it is actually set.
With the fix it remains 0 until actually set.

gcc/ChangeLog:
	* combine.cc (try_combine): Initialize newpat.

CC: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
 gcc/combine.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/combine.cc b/gcc/combine.cc
index 92b8d98e6c15..0b5fe00c8c5b 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -2522,7 +2522,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0,
 	     bool *new_direct_jump_p, rtx_insn *last_combined_insn)
 {
   /* New patterns for I3 and I2, respectively.  */
-  rtx newpat, newi2pat = 0;
+  rtx newpat = 0, newi2pat = 0;
   rtvec newpat_vec_with_clobbers = 0;
   bool substed_i2 = false, substed_i1 = false, substed_i0 = false;
   /* Indicates need to preserve SET in I0, I1 or I2 in I3 if it is not
-- 
2.34.1


  parent reply	other threads:[~2024-05-02 18:59 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02 18:59 [PATCH 0/3] Miscll fixlets Vineet Gupta
2024-05-02 18:59 ` [PATCH 1/3] docs: rtl: document GET_MODE_INNER Vineet Gupta
2024-05-02 20:36   ` Jeff Law
2024-05-02 20:48     ` [PATCH v2 " Vineet Gupta
2024-05-03 16:36       ` [Committed 1/2] " Vineet Gupta
2024-05-02 18:59 ` [PATCH 2/3] RISC-V: miscll comment fixes [NFC] Vineet Gupta
2024-05-02 20:36   ` Jeff Law
2024-05-03 16:37     ` [Committed 2/2] " Vineet Gupta
2024-05-02 18:59 ` Vineet Gupta [this message]
2024-05-02 20:38   ` [PATCH 3/3] combine: initialize a local var Jeff Law
2024-05-02 20:40     ` Vineet Gupta
2024-05-03  8:30     ` Segher Boessenkool
2024-05-03  8:26   ` Segher Boessenkool
2024-05-03 16:41     ` Vineet Gupta

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=20240502185924.2060196-4-vineetg@rivosinc.com \
    --to=vineetg@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gnu-toolchain@rivosinc.com \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=palmer@rivosinc.com \
    --cc=rdapp.gcc@gmail.com \
    --cc=segher@kernel.crashing.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).