From patchwork Tue Nov 19 11:54:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 292360 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7CEE12C00C2 for ; Tue, 19 Nov 2013 22:55:17 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=ciutF2FOWlyXp39ECPosHLTuY4hRG +adnV5ZuulL4BtJ+OSaYMwA9E4b1J4J8WLhcNPX6ZvSvBDUXSgSkpOiPKGIOwkLx jErH0g97uIghc8Jnu3KzIQH8NXUhcA4XZ6xVva5rott2piQkP4sGCzLU6IGr+NeK 0nu81fqcOXEIYQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=llUFNd7HmCjDLc//KSzMn8Fnw/w=; b=sbL DjZFV90ctgpFDadxlbdKxg/hB35XzGVCNOrPWrJXt8DoA4MOIDcuwRwBoaTxrGVt r3yMVO6yF4HuNc7SlN7VKCbek/8/kOryAOYYaz/jO5dkz4L2Sskvts16HGMcf6SF fyL2qEJa5cWgW2XWTErjtaF3LfB386qKdGaOXoBM= Received: (qmail 6811 invoked by alias); 19 Nov 2013 11:55:05 -0000 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 Received: (qmail 6799 invoked by uid 89); 19 Nov 2013 11:55:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL, BAYES_50, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-wi0-f170.google.com Received: from Unknown (HELO mail-wi0-f170.google.com) (209.85.212.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 19 Nov 2013 11:55:03 +0000 Received: by mail-wi0-f170.google.com with SMTP id f4so6487559wiw.5 for ; Tue, 19 Nov 2013 03:54:54 -0800 (PST) X-Received: by 10.180.160.212 with SMTP id xm20mr6985291wib.33.1384862094360; Tue, 19 Nov 2013 03:54:54 -0800 (PST) Received: from localhost ([2.28.235.51]) by mx.google.com with ESMTPSA id pi6sm33808534wic.3.2013.11.19.03.54.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Nov 2013 03:54:53 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, rdsandiford@googlemail.com Subject: [1/4] Use tree_to_uhwi with an inlined tree_fits_uhwi_p test References: <871u2cpq4u.fsf@talisman.default> Date: Tue, 19 Nov 2013 11:54:50 +0000 In-Reply-To: <871u2cpq4u.fsf@talisman.default> (Richard Sandiford's message of "Tue, 19 Nov 2013 11:50:09 +0000") Message-ID: <87txf8obcl.fsf@talisman.default> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 check_function_arguments_recurse has an assert that is equivalent to tree_fits_uhwi_p. The extraction can then use tree_to_uhwi. Asserting here makes the intent obvious, but tree_to_uhwi also asserts for the same thing, so an alternative would be to use tree_to_uhwi on its own. Thanks, Richard gcc/c-family/ 2013-11-19 Kenneth Zadeck * c-common.c (check_function_arguments_recurse): Use tree_fits_uhwi_p and tree_to_uhwi. Index: gcc/c-family/c-common.c =================================================================== --- gcc/c-family/c-common.c 2013-11-19 10:53:54.965643984 +0000 +++ gcc/c-family/c-common.c 2013-11-19 11:08:41.797920627 +0000 @@ -9209,10 +9209,9 @@ check_function_arguments_recurse (void ( to be valid. */ format_num_expr = TREE_VALUE (TREE_VALUE (attrs)); - gcc_assert (TREE_CODE (format_num_expr) == INTEGER_CST - && !TREE_INT_CST_HIGH (format_num_expr)); + gcc_assert (tree_fits_uhwi_p (format_num_expr)); - format_num = TREE_INT_CST_LOW (format_num_expr); + format_num = tree_to_uhwi (format_num_expr); for (inner_arg = first_call_expr_arg (param, &iter), i = 1; inner_arg != 0;