* [PATCH] fix logical operand type
@ 2013-05-16 20:56 Xi Wang
0 siblings, 0 replies; only message in thread
From: Xi Wang @ 2013-05-16 20:56 UTC (permalink / raw)
To: linux-sparse; +Cc: sparse, Xi Wang
The type of logical operands should be bool.
Signed-off-by: Xi Wang <xi.wang@gmail.com>
---
simplify.c seems to assume so.
case OP_AND_BOOL:
if (value == 1)
return replace_with_pseudo(insn, insn->src1);
---
evaluate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/evaluate.c b/evaluate.c
index c345a50..8954ff2 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -873,6 +873,8 @@ static struct symbol *evaluate_logical(struct expression *expr)
return NULL;
expr->ctype = &bool_ctype;
+ expr->left = cast_to(expr->left, &bool_ctype);
+ expr->right = cast_to(expr->right, &bool_ctype);
if (expr->flags) {
if (!(expr->left->flags & expr->right->flags & Int_const_expr))
expr->flags = 0;
--
1.8.1.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-05-16 21:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-16 20:56 [PATCH] fix logical operand type Xi Wang
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).