From: Mike Frysinger via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/6] sim: sh: fix uninitialized variable usage with pdmsb
Date: Sat, 6 Nov 2021 20:32:53 -0400 [thread overview]
Message-ID: <20211107003254.4298-5-vapier@gentoo.org> (raw)
In-Reply-To: <20211107003254.4298-1-vapier@gentoo.org>
This block of code relies on i to control which bits to test and how
many times to run through the loop, but it never actually initialized
it. There is another chunk of code that handles the pdmsb instruction
that sets i to 16, so use that here too assuming it's correct. The
programming manual suggests this is the right value too, but I am by
no means a SuperH DSP expert. The tests are still passing though ...
---
sim/sh/gencode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 9ef8b4610be1..80eecfdf1d36 100644
--- a/sim/sh/gencode.c
+++ b/sim/sh/gencode.c
@@ -2363,7 +2363,7 @@ op ppi_tab[] =
},
{ "","", "(if cc) pdmsb Sy,Dz", "101111cc..yyzzzz",
"unsigned Sy = DSP_R (y);",
- "int i;",
+ "int i = 16;",
"",
"if (Sy < 0)",
" Sy = ~Sy;",
--
2.33.0
next prev parent reply other threads:[~2021-11-07 0:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-07 0:32 [PATCH 1/6] sim: sh: rework register layout with anonymous unions & structs Mike Frysinger via Gdb-patches
2021-11-07 0:32 ` [PATCH 2/6] sim: sh: fix unused-value warnings Mike Frysinger via Gdb-patches
2021-11-07 0:32 ` [PATCH 3/6] sim: sh: fix various parentheses warnings Mike Frysinger via Gdb-patches
2021-11-07 0:32 ` [PATCH 4/6] sim: sh: constify a few read-only lookup tables Mike Frysinger via Gdb-patches
2021-11-07 0:32 ` Mike Frysinger via Gdb-patches [this message]
2021-11-07 0:32 ` [PATCH 6/6] sim: sh: enable -Werror everywhere Mike Frysinger via Gdb-patches
2021-11-11 12:41 ` [PATCH 1/6] sim: sh: rework register layout with anonymous unions & structs Luis Machado via Gdb-patches
2021-11-11 22:25 ` Mike Frysinger via Gdb-patches
2021-11-11 22:32 ` Luis Machado via Gdb-patches
2021-11-11 22:38 ` Luis Machado via Gdb-patches
2021-11-11 22:45 ` Mike Frysinger via Gdb-patches
2021-11-12 13:12 ` Luis Machado via Gdb-patches
2021-11-12 0:39 ` [PATCH 1/2] sim: sh: rework carry checks to not rely on integer overflows Mike Frysinger via Gdb-patches
2021-11-12 0:39 ` [PATCH 2/2] sim: sh: fix switch-bool warnings Mike Frysinger via Gdb-patches
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=20211107003254.4298-5-vapier@gentoo.org \
--to=gdb-patches@sourceware.org \
--cc=vapier@gentoo.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