This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Probable boolean logic error


On 2017-12-05 02:35, Michael McConville wrote:
Unless I’m misunderstanding, these two conditions reduce to “if
(true)” in their current form.
The most likely explanation is that someone mistakenly typed the wrong
boolean operator.

2017-12-04	Michael McConville	<mmcco@mykolab.com>

	* mips-linux-tdep.c (mips_linux_in_dynsym_stub): fix boolean typo in
two conditions

diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c
index ebdacd981e..6c236e14a1 100644
--- a/gdb/mips-linux-tdep.c
+++ b/gdb/mips-linux-tdep.c
@@ -709,15 +709,15 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
   insn = extract_unsigned_integer (p + 4, 4, byte_order);
   if (n64)
     {
-      /* 'daddu t7,ra' or 'or t7, ra, zero'*/
-      if (insn != 0x03e0782d || insn != 0x03e07825)
+      /* 'daddu t7,ra' and 'or t7, ra, zero'*/
+      if (insn != 0x03e0782d && insn != 0x03e07825)
 	return 0;

     }
   else
     {
-      /* 'addu t7,ra'  or 'or t7, ra, zero'*/
-      if (insn != 0x03e07821 || insn != 0x03e07825)
+      /* 'addu t7,ra' and 'or t7, ra, zero'*/
+      if (insn != 0x03e07821 && insn != 0x03e07825)
 	return 0;

     }

I agree that the current code doesn't really make sense. CC'ing Maciej (the MIPS maintainer) so he has more chance to see it.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]