public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Suppress riscv-selftests.cc warning.
@ 2022-09-17  0:59 juzhe.zhong
  2022-09-23 15:35 ` Kito Cheng
  0 siblings, 1 reply; 2+ messages in thread
From: juzhe.zhong @ 2022-09-17  0:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, Ju-Zhe Zhong

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


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

* Re: [PATCH] RISC-V: Suppress riscv-selftests.cc warning.
  2022-09-17  0:59 [PATCH] RISC-V: Suppress riscv-selftests.cc warning juzhe.zhong
@ 2022-09-23 15:35 ` Kito Cheng
  0 siblings, 0 replies; 2+ messages in thread
From: Kito Cheng @ 2022-09-23 15:35 UTC (permalink / raw)
  To: juzhe.zhong; +Cc: GCC Patches

Committed, but squashed changes to "RISC-V: Support poly move
manipulation and selftests." instead of a standalone commit.

On Sat, Sep 17, 2022 at 9:00 AM <juzhe.zhong@rivai.ai> wrote:
>
> 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
>

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

end of thread, other threads:[~2022-09-23 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17  0:59 [PATCH] RISC-V: Suppress riscv-selftests.cc warning juzhe.zhong
2022-09-23 15:35 ` Kito Cheng

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).