From patchwork Fri Jul 20 13:26:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 172276 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 940B62C00AB for ; Fri, 20 Jul 2012 23:26:59 +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=1343395619; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=afshaQUcUU7yFeZ15WXI VeFqNcs=; b=EqWHel/FXwD+Ob3QsJaLZ/DSsFFt921sssMtQg/6L+6t1fKCKCIY +Impkdxnrq84und3NI4TWa7bxk5YOP1VbvNn/6LWhmw8RpK08kxojqsmWLMBWeLO FthKj/gIzluaEqLSoyAUl1UDf7SMMIVumEg4RHzVmv/RNKkPVqMAbyc= 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:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=n4Cpax8T8XniXiRWSrd7UFbZR3TJAjpFRJwLbl34O/n4puNQet3kYraQvHA/BV ZvX5CPZ9skOeHs4PiDXBB0MjLITni52ugJiA3w/2Rwo0YY4G/DD91bO6Nzwaxrpx e/nLV/ImPEwqulUWSuJEB+GHwfiLBvpklFC3NdnC4Ms0E=; Received: (qmail 24255 invoked by alias); 20 Jul 2012 13:26:55 -0000 Received: (qmail 24245 invoked by uid 22791); 20 Jul 2012 13:26:54 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, 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, 20 Jul 2012 13:26:38 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6KDQccP008293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 20 Jul 2012 09:26:38 -0400 Received: from zalov.redhat.com (vpn1-7-92.ams2.redhat.com [10.36.7.92]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q6KDQaZm007191 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Jul 2012 09:26:38 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q6KDQZ2S006027; Fri, 20 Jul 2012 15:26:35 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q6KDQZiK006026; Fri, 20 Jul 2012 15:26:35 +0200 Date: Fri, 20 Jul 2012 15:26:34 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix a regression from build_cplus_array_type recent change (PR c++/54038) Message-ID: <20120720132634.GL4807@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 Hi! As detailed in the PR, I believe we should only add c into m's variant chain if m's element type is the main variant of c's element type. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.7? 2012-07-20 Jakub Jelinek PR c++/54038 * tree.c (build_cplus_array_type): Don't change TYPE_CANONICAL's TYPE_MAIN_VARIANT if it's element type's TYPE_MAIN_VARIANT is not m's element type. * g++.dg/other/array7.C: New test. Jakub --- gcc/cp/tree.c.jj 2012-07-19 22:43:19.000000000 +0200 +++ gcc/cp/tree.c 2012-07-20 12:54:41.014662931 +0200 @@ -814,7 +814,8 @@ build_cplus_array_type (tree elt_type, t /* If we built a new array type for TYPE_CANONICAL, add that to the list of variants as well. */ - if (c && c != t && TYPE_MAIN_VARIANT (c) != m) + if (c && c != t && TYPE_MAIN_VARIANT (c) != m + && TYPE_MAIN_VARIANT (TREE_TYPE (c)) == TYPE_MAIN_VARIANT (elt_type)) { TYPE_MAIN_VARIANT (c) = m; TYPE_NEXT_VARIANT (c) = t; --- gcc/testsuite/g++.dg/other/array7.C.jj 2012-07-20 12:58:26.118439241 +0200 +++ gcc/testsuite/g++.dg/other/array7.C 2012-07-20 12:56:50.000000000 +0200 @@ -0,0 +1,9 @@ +// PR c++/54038 + +extern const char *const v[]; +typedef char T; +void foo (const T *const[]); +struct A +{ + static const char *const a[]; +};