linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix type of canonicalization of sext + unsigned compare
@ 2021-01-17 15:13 Luc Van Oostenryck
  0 siblings, 0 replies; only message in thread
From: Luc Van Oostenryck @ 2021-01-17 15:13 UTC (permalink / raw)
  To: linux-sparse; +Cc: Luc Van Oostenryck

In commit 4a5f616407e2 ("cmp: canonicalize sext(x) cmpu C (with C >= SMAX)"),
the operand is replaced to avoid a sign extension but the corresponding
type was not updated. Fix this now.

Fixes: 4a5f616407e26efb67013f8267adef2d6e093bf1
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 simplify.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/simplify.c b/simplify.c
index b0d2c1b5b7c6..1e7648486c49 100644
--- a/simplify.c
+++ b/simplify.c
@@ -1225,12 +1225,14 @@ static int simplify_compare_constant(struct instruction *insn, long long value)
 		switch (insn->opcode) {
 		case OP_SET_BE:
 			if (value >= sign_bit(osize)) {
+				insn->itype = def->orig_type;
 				replace_binop_value(insn, OP_SET_GE, 0);
 				return replace_pseudo(insn, &insn->src1, def->src);
 			}
 			break;
 		case OP_SET_A:
 			if (value >= sign_bit(osize)) {
+				insn->itype = def->orig_type;
 				replace_binop_value(insn, OP_SET_LT, 0);
 				return replace_pseudo(insn, &insn->src1, def->src);
 			}
-- 
2.30.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-17 15:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-17 15:13 [PATCH] fix type of canonicalization of sext + unsigned compare Luc Van Oostenryck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).