From patchwork Fri Dec 17 17:46:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 75930 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 1AC4A1007D3 for ; Sat, 18 Dec 2010 04:46:49 +1100 (EST) Received: (qmail 16178 invoked by alias); 17 Dec 2010 17:46:48 -0000 Received: (qmail 16168 invoked by uid 22791); 17 Dec 2010 17:46:48 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD 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; Fri, 17 Dec 2010 17:46:42 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oBHHkfaJ018803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 17 Dec 2010 12:46:41 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oBHHkevl032575 for ; Fri, 17 Dec 2010 12:46:40 -0500 Message-ID: <4D0BA200.9090204@redhat.com> Date: Fri, 17 Dec 2010 12:46:40 -0500 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: gcc-patches List Subject: C++ PATCH for c++/46670 (ICE with dependent array ref in C++0x mode) 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 The constexpr changes mean that we check a lot more expressions for possibly being null pointer constants; in this testcase this broke because we weren't testing the dependency of an ARRAY_REF properly. Tested x86_64-pc-linux-gnu, applied to trunk. commit bfc1b301c86e9c4c029fcc942919fac810d32483 Author: Jason Merrill Date: Thu Dec 16 17:33:23 2010 -0500 PR c++/46670 * pt.c (value_dependent_expression_p) [ARRAY_REF]: Handle properly. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a696d3b..49016b3 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18108,6 +18108,10 @@ value_dependent_expression_p (tree expression) return ((value_dependent_expression_p (TREE_OPERAND (expression, 0))) || (value_dependent_expression_p (TREE_OPERAND (expression, 2)))); + case ARRAY_REF: + return ((value_dependent_expression_p (TREE_OPERAND (expression, 0))) + || (value_dependent_expression_p (TREE_OPERAND (expression, 1)))); + case ADDR_EXPR: { tree op = TREE_OPERAND (expression, 0); diff --git a/gcc/testsuite/g++.dg/constexpr-null1.C b/gcc/testsuite/g++.dg/constexpr-null1.C new file mode 100644 index 0000000..44cf9a0 --- /dev/null +++ b/gcc/testsuite/g++.dg/constexpr-null1.C @@ -0,0 +1,11 @@ +// PR c++/46670 +// { dg-options -std=c++0x } + +extern unsigned char __TBB_ReverseByte(unsigned char src); +extern unsigned char *reversed; +template T __TBB_ReverseBits(T src) +{ + unsigned char *original = (unsigned char *) &src; + for( int i = sizeof(T)-1; i--; ) + reversed[i] = __TBB_ReverseByte( original[sizeof(T)-i-1] ); +}