[PATCH 07/16] cast: fix shift signedness in cast simplification

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

 



In commit c64d1972a ("cast: prepare for more cast simplifications")
a unsigned right shift was inadvertently changed to a signed one.

Restore the correct signedness.

Fixes: c64d1972a ("cast: prepare for more cast simplifications")
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 simplify.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/simplify.c b/simplify.c
index 996b3672e..68195d5f9 100644
--- a/simplify.c
+++ b/simplify.c
@@ -995,7 +995,8 @@ static int simplify_cast(struct instruction *insn)
 		if (def->size >= size) {
 			pseudo_t val = def->src2;
 			if (val->type == PSEUDO_VAL) {
-				if (!(val->value >> (size-1)))
+				unsigned long long value = val->value;
+				if (!(value >> (size-1)))
 					goto simplify;
 			}
 		}
-- 
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