From: Daniel De Graaf <danieldegraaf@gmail.com>
Subject: [PATCH] Fix incorrect linearization of "x && y && z"
Date: Tue, 27 Oct 2009 18:02:30 -0500 [thread overview]
Message-ID: <4ae782bd.8602be0a.3a31.187a@mx.google.com> (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
next reply other threads:[~2009-10-27 23:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-27 23:02 Daniel De Graaf [this message]
2009-10-28 22:48 ` [PATCH] Fix incorrect linearization of "x && y && z" Christopher Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ae782bd.8602be0a.3a31.187a@mx.google.com \
--to=danieldegraaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).