gdb: fix -Wtautological-overlap-compare error in lm32-tdep.c
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 21 May 2020 17:22:10 +0000 (13:22 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 21 May 2020 17:22:10 +0000 (13:22 -0400)
commitaa370940e202a165ddc0be2fdc4383a82101a678
tree09eb4a59b9058d5b4b9e1a1ae399b16241a145f5
parent84d53fa9d281f057af5916f8663bc9a2872c5f6e
gdb: fix -Wtautological-overlap-compare error in lm32-tdep.c

Building with clang 11, we get:

    /home/smarchi/src/binutils-gdb/gdb/lm32-tdep.c:84:44: error: overlapping comparisons always evaluate to false [-Werror,-Wtautological-overlap-compare]
        return ((regnum >= SIM_LM32_EA_REGNUM) && (regnum <= SIM_LM32_BA_REGNUM))
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Indeed, this doesn't make sense, as EA_REGNUM is greater than BA_REGNUM.
I'll assume that it was just a mistake and that these two should be
swapped.

The regnums for BA and EA are contiguous, so ultimately this particular
part of the condition is only true if regnum is == EA or == BA.  These
registers are Exception Address and Breakpoint Address, so I guess it
makes sense for them to be in the system register group.

The relevant reference is here:

  https://www.latticesemi.com/-/media/LatticeSemi/Documents/UserManuals/JL/LatticeMico32ProcessorReferenceManual39.ashx?document_id=52077

gdb/ChangeLog:

* lm32-tdep.c (lm32_register_reggroup_p): Fix condition.
gdb/ChangeLog
gdb/lm32-tdep.c