From patchwork Wed Apr 3 12:36:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 233430 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 63A472C00B7 for ; Wed, 3 Apr 2013 23:36:39 +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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=NXAiCeaW6kgaUjHAfPd2s5ifcX2XV m/Sem1nYuIkBQGLb9OgzRaVnUQDvQdtOS0R+pd+aglKURQB4KeJ9hHQE8Jybot8V g2QBBuBjMnye8+V2tAiVRD9PSXSPlfwkoj9pnOZYg8D5BANlN7MF+jq8UkvnoiqJ p6FW2vLKmHNIOA= 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=LmHt+vjP1DAm9eiQK09BFII+Lu4=; b=bIV oTdSwZS3szJ7gX792GDESRHkr/h69NH5Z+4Kwkma8vjhiGZLIpF9whr7yucyjr3I 29eaxFzatY2WeoiqO1k4r3I1a9gsBMFNuOGucb5NHc87FInXUd6ExU5tQjxIlUUw PS8gAsrcWPpZK2w/r6Nb0/w67kR4Yptu23IobRRs= Received: (qmail 26628 invoked by alias); 3 Apr 2013 12:36:28 -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 26617 invoked by uid 89); 3 Apr 2013 12:36:27 -0000 X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 03 Apr 2013 12:36:10 +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 r33Ca9hS004731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Apr 2013 08:36:09 -0400 Received: from zalov.cz (vpn1-6-133.ams2.redhat.com [10.36.6.133]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r33Ca746003666 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 3 Apr 2013 08:36:08 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.cz (8.14.5/8.14.5) with ESMTP id r33Ca1Vg020323; Wed, 3 Apr 2013 14:36:06 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id r33Ca0Ik020322; Wed, 3 Apr 2013 14:36:00 +0200 Date: Wed, 3 Apr 2013 14:36:00 +0200 From: Jakub Jelinek To: Jason Merrill , Dodji Seketeli Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix up strip_typedefs (PR debug/56819) Message-ID: <20130403123600.GC4201@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi! On the following testcase we ICE with -fcompare-debug with --enable-checking=yes, because strip_typedefs copies args to a new TREE_VEC, but doesn't copy over NON_DEFAULT_TEMPLATE_ARGS_COUNT. For ENABLE_CHECKING the code requires that it is set, for !ENABLE_CHECKING it would be needed only if NON_DEFAULT_TEMPLATE_ARGS_COUNT was already non-NULL (otherwise GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT would use length of the TREE_VEC). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.8/4.7? 2013-04-03 Jakub Jelinek PR debug/56819 * tree.c (strip_typedefs): SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT on new_args. * g++.dg/debug/pr56819.C: New test. Jakub --- gcc/cp/tree.c.jj 2013-04-02 20:24:34.000000000 +0200 +++ gcc/cp/tree.c 2013-04-03 10:51:56.614548181 +0200 @@ -1255,8 +1255,16 @@ strip_typedefs (tree t) changed = true; } if (changed) - fullname = lookup_template_function (TREE_OPERAND (fullname, 0), - new_args); + { +#ifndef ENABLE_CHECKING + if (NON_DEFAULT_TEMPLATE_ARGS_COUNT (args)) +#endif + SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT + (new_args, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (args)); + fullname + = lookup_template_function (TREE_OPERAND (fullname, 0), + new_args); + } else ggc_free (new_args); } --- gcc/testsuite/g++.dg/debug/pr56819.C.jj 2013-04-03 10:57:55.187410867 +0200 +++ gcc/testsuite/g++.dg/debug/pr56819.C 2013-04-03 10:56:42.000000000 +0200 @@ -0,0 +1,27 @@ +// PR debug/56819 +// { dg-do compile } +// { dg-options "-fcompare-debug" } + +template +struct A +{ + template + struct B; +}; + +template +struct C +{ + typedef int I; +}; + +template +class D +{ + typedef A E; + typedef typename T::template B F; + typedef typename C ::I I; + A foo () { return A (); } +}; + +template class D >;