public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: juzhe.zhong@rivai.ai
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, Ju-Zhe Zhong <juzhe.zhong@rivai.ai>
Subject: [PATCH] RISC-V: Suppress riscv-selftests.cc warning.
Date: Sat, 17 Sep 2022 08:59:49 +0800	[thread overview]
Message-ID: <20220917005949.263893-1-juzhe.zhong@rivai.ai> (raw)

From: Ju-Zhe Zhong <juzhe.zhong@rivai.ai>

This patch is a fix patch for:
https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601643.html

Suppress the warning as follows:

../../../riscv-gcc/gcc/poly-int.h: In function
‘poly_int64 eval_value(rtx, std::map<unsigned int, rtx_def*>&)’:
../../../riscv-gcc/gcc/poly-int.h:845:48: warning:
‘*((void*)& op2_val +8)’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
     POLY_SET_COEFF (C, r, i, NCa (a.coeffs[i]) + b.coeffs[i]);
                                                ^
../../../riscv-gcc/gcc/config/riscv/riscv-selftests.cc:74:23:
note: ‘*((void*)& op2_val +8)’ was declared here
   poly_int64 op1_val, op2_val;

gcc/ChangeLog:

        * config/riscv/riscv-selftests.cc (eval_value): Add initial value.

---
 gcc/config/riscv/riscv-selftests.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv-selftests.cc b/gcc/config/riscv/riscv-selftests.cc
index 167cd47c880..490b6ed6b8e 100644
--- a/gcc/config/riscv/riscv-selftests.cc
+++ b/gcc/config/riscv/riscv-selftests.cc
@@ -71,7 +71,8 @@ eval_value (rtx x, std::map<unsigned, rtx> &regno_to_rtx)
   unsigned regno = REGNO (x);
   expr = regno_to_rtx[regno];
 
-  poly_int64 op1_val, op2_val;
+  poly_int64 op1_val = 0;
+  poly_int64 op2_val = 0;
   if (UNARY_P (expr))
     {
       op1_val = eval_value (XEXP (expr, 0), regno_to_rtx);
-- 
2.36.1


             reply	other threads:[~2022-09-17  1:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17  0:59 juzhe.zhong [this message]
2022-09-23 15:35 ` Kito Cheng

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=20220917005949.263893-1-juzhe.zhong@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@gmail.com \
    /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).