[PATCH] shift: avoid simplification of ASR(LSR(x,0),N)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In most circumstances, the case where the LSR's count is zero
won't happen because it would have been optimized away before.
However there is a very small posibility it would happen:
  at the first run of the simplification loop,
  if the LSR and the ASR are in two different Basic Blocks and
  the ASR's BB is processed before the LSR's BB (rare)

Reported-by: Ramsay Jones <ramsay@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 322450b86..e3b789f2a 100644
--- a/simplify.c
+++ b/simplify.c
@@ -600,7 +600,7 @@ static int simplify_shift(struct instruction *insn, pseudo_t pseudo, long long v
 			if (src2->type != PSEUDO_VAL)
 				break;
 			nval = src2->value;
-			if (nval > insn->size)
+			if (nval > insn->size || nval == 0)
 				break;
 			value += nval;
 			if (def->opcode == OP_LSR)
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux