Skip to content

Ghidra is a software reverse engineering (SRE) framework

decompiler: fix bit extractions with RuleShiftAnd and RuleShiftCompare

Fabian Kilger92091a7a2ad5
diff --git a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
index 0912e4f0e9..db74047ec0 100644
--- a/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
+++ b/Ghidra/Features/Decompiler/src/decompile/cpp/ruleaction.cc
@@ -4951,8 +4951,7 @@ int4 RuleShiftAnd::applyOp(PcodeOp *op,Funcdata &data)
mask &= fullmask;
}
if ((mask & nzm) != nzm) return 0;
- data.opSetOpcode(andop,CPUI_COPY); // AND effectively does nothing, so we change it to a copy
- data.opRemoveInput(andop,1);
+ data.opSetInput(op, invn, 0); // Bypass the INT_AND
return 1;
}