A cast of an OP_AND can be simplified away if the mask already 'cover' the value. However this cannot be done if the cast is in fact a sign-extension. Fix this by adding the appropriate check of OP_CAST vs. OP_SCAST Fixes: caeaf72d34d1e91aaea7340241232d1d877907b7 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 370d4cb81..dc4fd457b 100644 --- a/simplify.c +++ b/simplify.c @@ -1036,7 +1036,7 @@ static int simplify_cast(struct instruction *insn) } /* A cast of a "and" might be a no-op.. */ - if (def_opcode(src) == OP_AND) { + if (insn->opcode == OP_CAST && def_opcode(src) == OP_AND) { struct instruction *def = src->def; if (def->size >= size) { pseudo_t val = def->src2; -- 2.14.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