aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <siarheit@google.com>2021-11-14 17:39:35 +0000
committerSergei Trofimovich <siarheit@google.com>2021-11-16 23:32:00 +0000
commite97436b1b789dcdb6ffb502263f4c86f8bc22996 (patch)
treeb9f1a2bdf5eab33e6d1fb34298b5d5383dac1c08
parent7f74204ad972f6c0d0ff846af9f1f2f7e76fa5c5 (diff)
downloadgdb-e97436b1b789dcdb6ffb502263f4c86f8bc22996.zip
gdb-e97436b1b789dcdb6ffb502263f4c86f8bc22996.tar.gz
gdb-e97436b1b789dcdb6ffb502263f4c86f8bc22996.tar.bz2
sim: cr16: fix build on gcc-12 (NULL comparison)
On gcc-12 build fails as: sim/cr16/interp.c: In function 'lookup_hash': sim/cr16/interp.c:89:25: error: the comparison will always evaluate as 'true' for the address of 'mnimonic' will never be NULL [-Werror=address] 89 | if ((h->ops->mnimonic != NULL) && | ^~ 'mnimonic' is a sharr array within ops. It can never be NULL. While at it renamed 'mnimonic' to 'mnemonic'.
-rw-r--r--sim/cr16/cr16_sim.h2
-rw-r--r--sim/cr16/interp.c5
2 files changed, 3 insertions, 4 deletions
diff --git a/sim/cr16/cr16_sim.h b/sim/cr16/cr16_sim.h
index a865d09..35a9614 100644
--- a/sim/cr16/cr16_sim.h
+++ b/sim/cr16/cr16_sim.h
@@ -59,7 +59,7 @@ typedef uint32 creg_t;
struct simops
{
- char mnimonic[12];
+ char mnemonic[12];
uint32 size;
uint32 mask;
uint32 opcode;
diff --git a/sim/cr16/interp.c b/sim/cr16/interp.c
index 7bbcf3c..18e1db9 100644
--- a/sim/cr16/interp.c
+++ b/sim/cr16/interp.c
@@ -86,8 +86,7 @@ lookup_hash (SIM_DESC sd, SIM_CPU *cpu, uint64 ins, int size)
mask = (((1 << (32 - h->mask)) -1) << h->mask);
/* Adjuest mask for branch with 2 word instructions. */
- if ((h->ops->mnimonic != NULL) &&
- ((streq(h->ops->mnimonic,"b") && h->size == 2)))
+ if (streq(h->ops->mnemonic,"b") && h->size == 2)
mask = 0xff0f0000;
@@ -99,7 +98,7 @@ lookup_hash (SIM_DESC sd, SIM_CPU *cpu, uint64 ins, int size)
mask = (((1 << (32 - h->mask)) -1) << h->mask);
/* Adjuest mask for branch with 2 word instructions. */
- if ((streq(h->ops->mnimonic,"b")) && h->size == 2)
+ if ((streq(h->ops->mnemonic,"b")) && h->size == 2)
mask = 0xff0f0000;
}