From patchwork Wed Nov 10 12:09:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 70625 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 4C573B70CC for ; Wed, 10 Nov 2010 23:10:39 +1100 (EST) Received: (qmail 9089 invoked by alias); 10 Nov 2010 12:10:33 -0000 Received: (qmail 9076 invoked by uid 22791); 10 Nov 2010 12:10:30 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Wed, 10 Nov 2010 12:10:25 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id C93B6CB0328 for ; Wed, 10 Nov 2010 13:10:22 +0100 (CET) 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 2LE0mdJslMYL for ; Wed, 10 Nov 2010 13:10:22 +0100 (CET) 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 85BBECB0325 for ; Wed, 10 Nov 2010 13:10:22 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Adjust location info on array comparison expressions Date: Wed, 10 Nov 2010 13:09:33 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201011101309.33538.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This yields more precise coverage info. The patch also removes an incorrect DECL_PURE_P flag set on a couple of support functions. Tested on i586-suse-linux, applied on the mainline. 2010-11-10 Eric Botcazou * gcc-interface/trans.c (gigi): Don't set 'pure' flag on SJLJ routines. * gcc-interface/utils2.c (compare_arrays): Add LOC parameter. Set it directly on all the comparison expressions. (build_binary_op): Pass input_location to compare_arrays. Index: gcc-interface/utils2.c =================================================================== --- gcc-interface/utils2.c (revision 166490) +++ gcc-interface/utils2.c (working copy) @@ -235,7 +235,7 @@ find_common_type (tree t1, tree t2) tests in as efficient a manner as possible. */ static tree -compare_arrays (tree result_type, tree a1, tree a2) +compare_arrays (location_t loc, tree result_type, tree a1, tree a2) { tree result = convert (result_type, boolean_true_node); tree a1_is_null = convert (result_type, boolean_false_node); @@ -296,10 +296,10 @@ compare_arrays (tree result_type, tree a ub1 = TYPE_MAX_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); lb1 = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (t1))); - comparison = build_binary_op (LT_EXPR, result_type, ub1, lb1); + comparison = fold_build2_loc (loc, LT_EXPR, result_type, ub1, lb1); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); if (EXPR_P (comparison)) - SET_EXPR_LOCATION (comparison, input_location); + SET_EXPR_LOCATION (comparison, loc); this_a1_is_null = comparison; this_a2_is_null = convert (result_type, boolean_true_node); @@ -321,16 +321,15 @@ compare_arrays (tree result_type, tree a bt = get_base_type (TREE_TYPE (ub1)); comparison - = build_binary_op (EQ_EXPR, result_type, + = fold_build2_loc (loc, EQ_EXPR, result_type, build_binary_op (MINUS_EXPR, bt, ub1, lb1), build_binary_op (MINUS_EXPR, bt, ub2, lb2)); comparison = SUBSTITUTE_PLACEHOLDER_IN_EXPR (comparison, a1); if (EXPR_P (comparison)) - SET_EXPR_LOCATION (comparison, input_location); + SET_EXPR_LOCATION (comparison, loc); - this_a1_is_null = build_binary_op (LT_EXPR, result_type, ub1, lb1); - if (EXPR_P (this_a1_is_null)) - SET_EXPR_LOCATION (this_a1_is_null, input_location); + this_a1_is_null + = fold_build2_loc (loc, LT_EXPR, result_type, ub1, lb1); this_a2_is_null = convert (result_type, boolean_false_node); } @@ -342,31 +341,27 @@ compare_arrays (tree result_type, tree a length2 = SUBSTITUTE_PLACEHOLDER_IN_EXPR (length2, a2); comparison - = build_binary_op (EQ_EXPR, result_type, length1, length2); - if (EXPR_P (comparison)) - SET_EXPR_LOCATION (comparison, input_location); + = fold_build2_loc (loc, EQ_EXPR, result_type, length1, length2); /* If the length expression is of the form (cond ? val : 0), assume that cond is equivalent to (length != 0). That's guaranteed by construction of the array types in gnat_to_gnu_entity. */ if (TREE_CODE (length1) == COND_EXPR && integer_zerop (TREE_OPERAND (length1, 2))) - this_a1_is_null = invert_truthvalue (TREE_OPERAND (length1, 0)); + this_a1_is_null + = invert_truthvalue_loc (loc, TREE_OPERAND (length1, 0)); else - this_a1_is_null = build_binary_op (EQ_EXPR, result_type, length1, - size_zero_node); - if (EXPR_P (this_a1_is_null)) - SET_EXPR_LOCATION (this_a1_is_null, input_location); + this_a1_is_null = fold_build2_loc (loc, EQ_EXPR, result_type, + length1, size_zero_node); /* Likewise for the second array. */ if (TREE_CODE (length2) == COND_EXPR && integer_zerop (TREE_OPERAND (length2, 2))) - this_a2_is_null = invert_truthvalue (TREE_OPERAND (length2, 0)); + this_a2_is_null + = invert_truthvalue_loc (loc, TREE_OPERAND (length2, 0)); else - this_a2_is_null = build_binary_op (EQ_EXPR, result_type, length2, - size_zero_node); - if (EXPR_P (this_a2_is_null)) - SET_EXPR_LOCATION (this_a2_is_null, input_location); + this_a2_is_null = fold_build2_loc (loc, EQ_EXPR, result_type, + length2, size_zero_node); } /* Append expressions for this dimension to the final expressions. */ @@ -396,9 +391,7 @@ compare_arrays (tree result_type, tree a a2 = convert (type, a2); } - comparison = fold_build2 (EQ_EXPR, result_type, a1, a2); - if (EXPR_P (comparison)) - SET_EXPR_LOCATION (comparison, input_location); + comparison = fold_build2_loc (loc, EQ_EXPR, result_type, a1, a2); result = build_binary_op (TRUTH_ANDIF_EXPR, result_type, result, comparison); @@ -784,8 +777,8 @@ build_binary_op (enum tree_code op_code, || (TREE_CODE (right_type) == INTEGER_TYPE && TYPE_HAS_ACTUAL_BOUNDS_P (right_type)))) { - result = compare_arrays (result_type, left_operand, right_operand); - + result = compare_arrays (input_location, + result_type, left_operand, right_operand); if (op_code == NE_EXPR) result = invert_truthvalue_loc (EXPR_LOCATION (result), result); else Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 166532) +++ gcc-interface/trans.c (working copy) @@ -399,8 +399,6 @@ gigi (Node_Id gnat_root, int max_gnat_no (get_identifier ("system__soft_links__get_jmpbuf_address_soft"), NULL_TREE, build_function_type (jmpbuf_ptr_type, NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); - /* Avoid creating superfluous edges to __builtin_setjmp receivers. */ - DECL_PURE_P (get_jmpbuf_decl) = 1; DECL_IGNORED_P (get_jmpbuf_decl) = 1; set_jmpbuf_decl @@ -502,8 +500,6 @@ gigi (Node_Id gnat_root, int max_gnat_no NULL_TREE, build_function_type (build_pointer_type (except_type_node), NULL_TREE), NULL_TREE, false, true, true, NULL, Empty); - /* Avoid creating superfluous edges to __builtin_setjmp receivers. */ - DECL_PURE_P (get_excptr_decl) = 1; raise_nodefer_decl = create_subprog_decl