* [PATCH] Fix incorrect linearization of "x && y && z"
@ 2009-10-27 23:02 Daniel De Graaf
2009-10-28 22:48 ` Christopher Li
0 siblings, 1 reply; 2+ messages in thread
From: Daniel De Graaf @ 2009-10-27 23:02 UTC (permalink / raw)
This fixes an incorrect assumption that results in && using shortcut
logic on the true branch instead of the false branch.
Signed-off-by: Daniel De Graaf <danieldegraaf@gmail.com>
---
linearize.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/linearize.c b/linearize.c
index 238ee5d..9247409 100644
--- a/linearize.c
+++ b/linearize.c
@@ -1389,7 +1389,10 @@ static pseudo_t linearize_logical(struct entrypoint *ep, struct expression *expr
shortcut = alloc_const_expression(expr->pos, expr->op == SPECIAL_LOGICAL_OR);
shortcut->ctype = expr->ctype;
- return linearize_conditional(ep, expr, expr->left, shortcut, expr->right);
+ if (expr->op == SPECIAL_LOGICAL_OR)
+ return linearize_conditional(ep, expr, expr->left, shortcut, expr->right);
+ else
+ return linearize_conditional(ep, expr, expr->left, expr->right, shortcut);
}
static pseudo_t linearize_compare(struct entrypoint *ep, struct expression *expr)
--
1.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix incorrect linearization of "x && y && z"
2009-10-27 23:02 [PATCH] Fix incorrect linearization of "x && y && z" Daniel De Graaf
@ 2009-10-28 22:48 ` Christopher Li
0 siblings, 0 replies; 2+ messages in thread
From: Christopher Li @ 2009-10-28 22:48 UTC (permalink / raw)
To: Daniel De Graaf; +Cc: Linux-Sparse
On Tue, Oct 27, 2009 at 4:02 PM, Daniel De Graaf
<danieldegraaf@gmail.com> wrote:
> This fixes an incorrect assumption that results in && using shortcut
> logic on the true branch instead of the false branch.
Good catch. Thanks!
I applied it without the "else" line.
Chris
PS. I almost miss this email because it is send to "unlisted-recipients".
My patch tool catches it though.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-10-28 22:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27 23:02 [PATCH] Fix incorrect linearization of "x && y && z" Daniel De Graaf
2009-10-28 22:48 ` Christopher Li
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).