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'.
This commit is contained in:
Sergei Trofimovich
2021-11-14 17:39:35 +00:00
parent 7f74204ad9
commit e97436b1b7
2 changed files with 3 additions and 4 deletions

View File

@ -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;
}