From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1042 invoked by alias); 9 May 2011 18:37:15 -0000 Received: (qmail 726 invoked by uid 22791); 9 May 2011 18:37:14 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 May 2011 18:36:59 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 87479CB0219 for ; Mon, 9 May 2011 20:36:58 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eu-a7Lf6GSYE for ; Mon, 9 May 2011 20:36:55 +0200 (CEST) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 7C36ECB01ED for ; Mon, 9 May 2011 20:36:55 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Use expr_location_or in more cases Date: Mon, 09 May 2011 19:56:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_DRDyN5dO/n+062y" Message-Id: <201105092036.51722.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg00683.txt.bz2 --Boundary-00=_DRDyN5dO/n+062y Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1122 This patch changes fold_ternary_loc to use the new expr_location_or instead of the manual equivalent; no functional changes. Once this is done, grepping the file for UNKNOWN_LOCATION yields one occurrence (apart from expr_location_or): if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0)) && merge_ranges (&in_p, &low, &high, in0_p, low0, high0, in1_p, low1, high1) && 0 != (tem = (build_range_check (UNKNOWN_LOCATION, type, lhs != 0 ? lhs : rhs != 0 ? rhs : integer_zero_node, in_p, low, high)))) { if (strict_overflow_p) fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_COMPARISON); return or_op ? invert_truthvalue_loc (loc, tem) : tem; } It comes from the original loc-ification patch and seems to be an oversight, as invert_truthvalue_loc uses LOC just below. Changed to using LOC as well. Tested on i586-suse-linux, applied on the mainline as obvious. 2011-05-09 Eric Botcazou * fold-const.c (fold_range_test): Pass LOC to build_range_check. (fold_ternary_loc): Use expr_location_or. -- Eric Botcazou --Boundary-00=_DRDyN5dO/n+062y Content-Type: text/x-diff; charset="iso 8859-15"; name="p.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="p.diff" Content-length: 2293 Index: fold-const.c =================================================================== --- fold-const.c (revision 173545) +++ fold-const.c (working copy) @@ -4822,7 +4822,7 @@ fold_range_test (location_t loc, enum tr if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0)) && merge_ranges (&in_p, &low, &high, in0_p, low0, high0, in1_p, low1, high1) - && 0 != (tem = (build_range_check (UNKNOWN_LOCATION, type, + && 0 != (tem = (build_range_check (loc, type, lhs != 0 ? lhs : rhs != 0 ? rhs : integer_zero_node, in_p, low, high)))) @@ -13332,9 +13332,7 @@ fold_ternary_loc (location_t loc, enum t TREE_OPERAND (arg0, 1)) && !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (op2)))) { - location_t loc0 = EXPR_LOCATION (arg0); - if (loc0 == UNKNOWN_LOCATION) - loc0 = loc; + location_t loc0 = expr_location_or (arg0, loc); tem = fold_truth_not_expr (loc0, arg0); if (tem && COMPARISON_CLASS_P (tem)) { @@ -13349,9 +13347,7 @@ fold_ternary_loc (location_t loc, enum t if (truth_value_p (TREE_CODE (arg0)) && tree_swap_operands_p (op1, op2, false)) { - location_t loc0 = EXPR_LOCATION (arg0); - if (loc0 == UNKNOWN_LOCATION) - loc0 = loc; + location_t loc0 = expr_location_or (arg0, loc); /* See if this can be inverted. If it can't, possibly because it was a floating-point inequality comparison, don't do anything. */ @@ -13500,9 +13496,7 @@ fold_ternary_loc (location_t loc, enum t && truth_value_p (TREE_CODE (arg0)) && truth_value_p (TREE_CODE (arg1))) { - location_t loc0 = EXPR_LOCATION (arg0); - if (loc0 == UNKNOWN_LOCATION) - loc0 = loc; + location_t loc0 = expr_location_or (arg0, loc); /* Only perform transformation if ARG0 is easily inverted. */ tem = fold_truth_not_expr (loc0, arg0); if (tem) @@ -13516,9 +13510,7 @@ fold_ternary_loc (location_t loc, enum t && truth_value_p (TREE_CODE (arg0)) && truth_value_p (TREE_CODE (op2))) { - location_t loc0 = EXPR_LOCATION (arg0); - if (loc0 == UNKNOWN_LOCATION) - loc0 = loc; + location_t loc0 = expr_location_or (arg0, loc); /* Only perform transformation if ARG0 is easily inverted. */ tem = fold_truth_not_expr (loc0, arg0); if (tem) --Boundary-00=_DRDyN5dO/n+062y--