aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-linux-tdep.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-05-16 11:21:41 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-05-16 11:21:41 -0400
commit59f7bd8d2b855162db6784c9724ead9e2377f32c (patch)
tree032afd1f753c755bf0b5f19e0ce67727aa53410a /gdb/mips-linux-tdep.c
parent56770bdab2585be4d3171b3512d2167106dca53e (diff)
downloadgdb-59f7bd8d2b855162db6784c9724ead9e2377f32c.zip
gdb-59f7bd8d2b855162db6784c9724ead9e2377f32c.tar.gz
gdb-59f7bd8d2b855162db6784c9724ead9e2377f32c.tar.bz2
gdb: fix -Wtautological-overlap-compare warning in mips-linux-tdep.c
When building with clang 11, I get: CXX mips-linux-tdep.o /home/smarchi/src/binutils-gdb/gdb/mips-linux-tdep.c:643:30: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare] if (insn != 0x03e07821 || insn != 0x03e07825) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /home/smarchi/src/binutils-gdb/gdb/mips-linux-tdep.c:636:30: error: overlapping comparisons always evaluate to true [-Werror,-Wtautological-overlap-compare] if (insn != 0x03e0782d || insn != 0x03e07825) ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ Indeed, given two different values, `insn` will always be different to one of them, and these conditions always be true. This code is meant to return if `insn` isn't one of these two values, so the `||` should be replaced with `&&`. gdb/ChangeLog: * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Fix condition.
Diffstat (limited to 'gdb/mips-linux-tdep.c')
-rw-r--r--gdb/mips-linux-tdep.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index aa7b8d1..3ffd53d 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -633,16 +633,14 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
if (n64)
{
/* 'daddu t7,ra' or 'or t7, ra, zero'*/
- if (insn != 0x03e0782d || insn != 0x03e07825)
+ if (insn != 0x03e0782d && insn != 0x03e07825)
return 0;
-
}
else
{
/* 'addu t7,ra' or 'or t7, ra, zero'*/
- if (insn != 0x03e07821 || insn != 0x03e07825)
+ if (insn != 0x03e07821 && insn != 0x03e07825)
return 0;
-
}
insn = extract_unsigned_integer (p + 8, 4, byte_order);