aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-11-06 13:19:35 -0400
committerMike Frysinger <vapier@gentoo.org>2021-11-06 20:32:31 -0400
commit524d770c9c127e077f59f0b2adadc9c14d003e0a (patch)
treec1d927fa9af90248d73ff3bcd96be027311870b2 /sim
parentee7af46230f0382eb5091592ce0d5e45ee2fa142 (diff)
downloadgdb-524d770c9c127e077f59f0b2adadc9c14d003e0a.zip
gdb-524d770c9c127e077f59f0b2adadc9c14d003e0a.tar.gz
gdb-524d770c9c127e077f59f0b2adadc9c14d003e0a.tar.bz2
sim: sh: fix uninitialized variable usage with pdmsb
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 ...
Diffstat (limited to 'sim')
-rw-r--r--sim/sh/gencode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sim/sh/gencode.c b/sim/sh/gencode.c
index 9ef8b46..80eecfd 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;",