From patchwork Thu Aug 23 18:34:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 179703 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 2170B2C009E for ; Fri, 24 Aug 2012 04:35:16 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346351717; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=j/oJFkI lpa5gJsF7ZUXoSwPaMig=; b=kTekh7X/2IKMe1LNVmWU3dLWOQZ+pHOMk1Q9h+G OZl7PfRxXiwGjep8WL7YTsZxw+uyR9vdOjBE/m7CryIkCJ6mfzQwMB1lx+thp2wd shi9bwfdKiGf9+pBcdKJwvFMGLwscI7GOplOD22vcRSnQAyhN0DjIR5FBXnWRx6q 64f4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=a8bpcVzzcyu5AzK8+OO8OrqVt8HKiTqWB/k56NVfemQyCZi/4wCSxtzFFuaRGF 80BgTEmVW/DiszwRGvq4CkWstva/hG9mHPJ/4Rj24fPebBNjV4EoLp/mk0d4mEZl 8seLSl7Vn1XUggcpLFHCvVMba5GxPo3q7GHzVtb5m7AQE=; Received: (qmail 17308 invoked by alias); 23 Aug 2012 18:35:13 -0000 Received: (qmail 17182 invoked by uid 22791); 23 Aug 2012 18:35:12 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS, TW_CX X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Aug 2012 18:34:57 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q7NIYuLG000871 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 23 Aug 2012 14:34:56 -0400 Received: from [10.3.113.29] (ovpn-113-29.phx2.redhat.com [10.3.113.29]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q7NIYtcb026863 for ; Thu, 23 Aug 2012 14:34:56 -0400 Message-ID: <503677CF.8000406@redhat.com> Date: Thu, 23 Aug 2012 14:34:55 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120717 Thunderbird/14.0 MIME-Version: 1.0 To: gcc-patches List Subject: Minor C++ PATCH to compute_array_index_type 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 There was a comment here wondering why we were using dependent_type_p instead of type_dependent_expression_p; this patch makes the change. I also tweaked the definitions of cp_walk_tree to use more helpful names for the macro arguments. Tested x86_64-pc-linux-gnu, applying to trunk. commit 6786d0f99286c6f0d7170731dec475dc5755774c Author: Jason Merrill Date: Tue Jul 31 14:49:05 2012 -0400 * decl.c (compute_array_index_type): Use type_dependent_expression_p. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 54615bb..a787ec1 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5775,10 +5775,10 @@ extern linkage_kind decl_linkage (tree); extern duration_kind decl_storage_duration (tree); extern tree cp_walk_subtrees (tree*, int*, walk_tree_fn, void*, struct pointer_set_t*); -#define cp_walk_tree(a,b,c,d) \ - walk_tree_1 (a, b, c, d, cp_walk_subtrees) -#define cp_walk_tree_without_duplicates(a,b,c) \ - walk_tree_without_duplicates_1 (a, b, c, cp_walk_subtrees) +#define cp_walk_tree(tp,func,data,pset) \ + walk_tree_1 (tp, func, data, pset, cp_walk_subtrees) +#define cp_walk_tree_without_duplicates(tp,func,data) \ + walk_tree_without_duplicates_1 (tp, func, data, cp_walk_subtrees) extern tree fold_if_not_in_template (tree); extern tree rvalue (tree); extern tree convert_bitfield_to_declared_type (tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 365ca94..4b2958c 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -7916,7 +7916,6 @@ stabilize_vla_size (tree size) tree compute_array_index_type (tree name, tree size, tsubst_flags_t complain) { - tree type; tree itype; tree osize = size; tree abi_1_itype = NULL_TREE; @@ -7924,10 +7923,10 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) if (error_operand_p (size)) return error_mark_node; - type = TREE_TYPE (size); - /* type_dependent_expression_p? */ - if (!dependent_type_p (type)) + if (!type_dependent_expression_p (size)) { + tree type = TREE_TYPE (size); + mark_rvalue_use (size); if (cxx_dialect < cxx0x && TREE_CODE (size) == NOP_EXPR @@ -7989,7 +7988,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain) /* We can only call value_dependent_expression_p on integral constant expressions; treat non-constant expressions as dependent, too. */ if (processing_template_decl - && (dependent_type_p (type) + && (type_dependent_expression_p (size) || !TREE_CONSTANT (size) || value_dependent_expression_p (size))) { /* We cannot do any checking for a SIZE that isn't known to be