From patchwork Fri May 24 13:30:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xi Wang X-Patchwork-Id: 2611411 Return-Path: X-Original-To: patchwork-linux-sparse@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id AD14C3FD4E for ; Fri, 24 May 2013 13:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753341Ab3EXNcU (ORCPT ); Fri, 24 May 2013 09:32:20 -0400 Received: from mail-vc0-f180.google.com ([209.85.220.180]:64457 "EHLO mail-vc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007Ab3EXNcT (ORCPT ); Fri, 24 May 2013 09:32:19 -0400 Received: by mail-vc0-f180.google.com with SMTP id gd11so3137794vcb.11 for ; Fri, 24 May 2013 06:32:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=FXBdNzr6X/az52X823FGU4um81nrAkjDXCRk0pRDtuc=; b=QuVTOM9fgCAITKyjaNzfqXLfqFEfPo1YbCXTOMbpQ/79KvWtzL6Iw1T6YpUwdCcVjV /XjzB8d9GrNt80S8UDxLvJ0HZSeCXi6YZFzHZwfDHkbkK0kgAhZxn6Dr3ZKZJ3jrxHrw Lcte0xjmpWPjYr5/qUlXdjv7cnCjBh602Avwino2AOb/XT3TarZDrGKUC8GZr9I8o2CL LSYXE5mYmmFu3FEuGvpp7mMM7Jy0vkXLpvUk9BiCzjWj36zy9xpTpE1ttwChc020Pmi4 fY/TwwZIsaaxZhMzIy+IOLEkjFWIh2QLwz0cLzQdFUiRqdYZPZ6dEfLoTdTs8AGuZIAy AeoQ== X-Received: by 10.52.240.238 with SMTP id wd14mr7363329vdc.81.1369402338610; Fri, 24 May 2013 06:32:18 -0700 (PDT) Received: from hchen.csail.mit.edu (hchen.csail.mit.edu. [18.26.5.5]) by mx.google.com with ESMTPSA id tk7sm8758070vdc.0.2013.05.24.06.32.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 May 2013 06:32:18 -0700 (PDT) From: Xi Wang To: linux-sparse@vger.kernel.org Cc: Christopher Li , Xi Wang Subject: [PATCH 2/2] fix expression type for floating point ! Date: Fri, 24 May 2013 09:30:36 -0400 Message-Id: <1369402236-16871-2-git-send-email-xi.wang@gmail.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1369402236-16871-1-git-send-email-xi.wang@gmail.com> References: <1369402236-16871-1-git-send-email-xi.wang@gmail.com> Sender: linux-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org Run test-linearize against this program. static int foo(float x) { return !x; } The output is: set.32 %r2 <- 0.000000 bad_op.32 ret.32 %r3 The expression type of zero testing should be EXPR_COMPARE, rather than EXPR_BINOP, which causes bad_op. Signed-off-by: Xi Wang Acked-By: Christopher Li --- evaluate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evaluate.c b/evaluate.c index 5d87444..19be637 100644 --- a/evaluate.c +++ b/evaluate.c @@ -1797,7 +1797,7 @@ static struct symbol *evaluate_preop(struct expression *expr) warning(expr->pos, "testing a 'safe expression'"); if (is_float_type(ctype)) { struct expression *arg = expr->unop; - expr->type = EXPR_BINOP; + expr->type = EXPR_COMPARE; expr->op = SPECIAL_EQUAL; expr->left = arg; expr->right = alloc_expression(expr->pos, EXPR_FVALUE);