]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
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)
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

index 4574440578870d36b6f84638e74dc1090f85b8b9..0b38daf3e3d96dfc00fb3c1d2390f0d32ff20578 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-21  Simon Marchi  <simon.marchi@efficios.com>
+
+       * lm32-tdep.c (lm32_register_reggroup_p): Fix condition.
+
 2020-05-21  Simon Marchi  <simon.marchi@efficios.com>
 
        * coffread.c (patch_type): Remove NULL check before xfree.
index 6b5bb1507ff37d788ec759f7991a2c533207239d..73f8ae746f7861cadd0ffa9989fe2fe1c78ca65e 100644 (file)
@@ -81,7 +81,7 @@ lm32_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
     return ((regnum >= SIM_LM32_R0_REGNUM) && (regnum <= SIM_LM32_RA_REGNUM))
       || (regnum == SIM_LM32_PC_REGNUM);
   else if (group == system_reggroup)
-    return ((regnum >= SIM_LM32_EA_REGNUM) && (regnum <= SIM_LM32_BA_REGNUM))
+    return ((regnum >= SIM_LM32_BA_REGNUM) && (regnum <= SIM_LM32_EA_REGNUM))
       || ((regnum >= SIM_LM32_EID_REGNUM) && (regnum <= SIM_LM32_IP_REGNUM));
   return default_register_reggroup_p (gdbarch, regnum, group);
 }