From patchwork Thu May 16 20:56:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Wang X-Patchwork-Id: 2580261 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 32425E00E6 for ; Thu, 16 May 2013 21:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753908Ab3EPVEg (ORCPT ); Thu, 16 May 2013 17:04:36 -0400 Received: from mail-gg0-f179.google.com ([209.85.161.179]:51784 "EHLO mail-gg0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346Ab3EPVEg (ORCPT ); Thu, 16 May 2013 17:04:36 -0400 X-Greylist: delayed 411 seconds by postgrey-1.27 at vger.kernel.org; Thu, 16 May 2013 17:04:36 EDT Received: by mail-gg0-f179.google.com with SMTP id c4so168400ggn.10 for ; Thu, 16 May 2013 14:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=7kukaZVEK24fNj1Y1s3DyZhtNKItiQa0weNd3Uz8+fI=; b=m3viD/LsXetdFTZ630rsZdS3qfU/0UYj9bcgz8qbiPitJbbaOSjnS4sLo+dzElIJgA LX36eo7oEu8qWgP0M8P/AJyoiQyJJAS8tPEaFkDulkrBpJBKWicxMuBQDACF8SwM/bTR aXcoDbCjpn3oIIyI7l+czwB17ynEClYAJh+CknbYEYjNP251gZzANiZiu7f4nzB/Y/+S nrgpmk0zuakP+4lyJN+D/UbhwpAU/bFxqGr9or/WH20GdQ6miw+wuWREZO1JmlKLBjZe SCQ/mGNBvv6+/swwvIca/C1tODpdvvAyUqGxqF8xxVRL/KulVmLsfPtHmy4BBhPVvATt 9w3w== X-Received: by 10.236.67.36 with SMTP id i24mr12930207yhd.172.1368737865285; Thu, 16 May 2013 13:57:45 -0700 (PDT) Received: from hchen.csail.mit.edu (hchen.csail.mit.edu. [18.26.5.5]) by mx.google.com with ESMTPSA id v34sm11821402yhn.26.2013.05.16.13.57.44 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 16 May 2013 13:57:44 -0700 (PDT) From: Xi Wang To: linux-sparse@vger.kernel.org Cc: sparse@chrisli.org, Xi Wang Subject: [PATCH] fix logical operand type Date: Thu, 16 May 2013 16:56:19 -0400 Message-Id: <1368737779-6601-1-git-send-email-xi.wang@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org The type of logical operands should be bool. Signed-off-by: Xi Wang --- 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;