capstone-engine / capstone

Capstone disassembly/disassembler framework for ARM, ARM64 (ARMv8), Alpha, BPF, Ethereum VM, HPPA, LoongArch, M68K, M680X, Mips, MOS65XX, PPC, RISC-V(rv32G/rv64G), SH, Sparc, SystemZ, TMS320C64X, TriCore, Webassembly, XCore and X86.
http://www.capstone-engine.org
7.62k stars 1.56k forks source link

dead code in tms #976

Open radare opened 7 years ago

radare commented 7 years ago
*** CID 166027:  Control flow issues  (DEADCODE)
/arch/TMS320C64x/TMS320C64xDisassembler.c: 291 in DecodeMemOperandSc()
285             case 12:
286             case 13:
287             case 14:
288             case 15:
289                 if((offset >= TMS320C64X_REG_A0) && (offset <= TMS320C64X_REG_A31))
290                     offset = (offset - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
   CID 166027:  Control flow issues  (DEADCODE)
   Execution cannot reach the expression "offset <= TMS320C64X_REG_B31" inside this statement: "if (offset >= TMS320C64X_RE...".
291                 else if((offset >= TMS320C64X_REG_B0) && (offset <= TMS320C64X_REG_B31))
292                     offset = (base - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
293                 offsetreg = getReg(GPRegsDecoderTable, offset);
294                 MCOperand_CreateImm0(Inst, (scaled << 19) | (basereg << 12) | (offsetreg << 5) | (mode << 1) | unit);
295                 break;
296             default:
radare commented 7 years ago

also in

_____________________
*** CID 166024:  Control flow issues  (DEADCODE)
/arch/TMS320C64x/TMS320C64xDisassembler.c: 270 in DecodeMemOperandSc()
264         offset = (Val >> 5) & 0x1f;
265         mode = (Val >> 1) & 0xf;
266         unit = Val & 1;
267     
268         if((base >= TMS320C64X_REG_A0) && (base <= TMS320C64X_REG_A31))
269             base = (base - TMS320C64X_REG_A0 + TMS320C64X_REG_B0);
   CID 166024:  Control flow issues  (DEADCODE)
   Execution cannot reach the expression "base <= TMS320C64X_REG_B31" inside this statement: "if (base >= TMS320C64X_REG_...".
270         else if((base >= TMS320C64X_REG_B0) && (base <= TMS320C64X_REG_B31))
271             base = (base - TMS320C64X_REG_B0 + TMS320C64X_REG_A0);
272         basereg = getReg(GPRegsDecoderTable, base);
273     
274         switch(mode) {
275             case 0:

** CID 166023:  Memory - illegal accesses  (OVERRUN)
/arch/TMS320C64x/TMS320C64xMapping.c: 1779 in TMS320C64x_group_name()