From patchwork Mon Oct 15 15:04:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 191818 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 DB8442C00A7 for ; Wed, 17 Oct 2012 02:22:52 +1100 (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=1351005773; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Resent-From:Resent-Date:Resent-Message-ID: Resent-To: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=iePQ1hYhZYE3a8OND8V4 uvsL8/I=; b=VGputpMw7QkwhidIqh2I2g03YlRUEMO/1fhLE8ESr7FvN315DYk1 7gSk6ry/447dvdI5U3d5qxEse3Ry0nuueIGGiGTP5RzeByFTmdN5DrY3s65iMD8Z DPzoSePEBf+yMjdQM68Y6O7Cmtf0gE0tSiGjlVxZZTlhm1ubqIMOEFY= 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:Resent-From:Resent-Date:Resent-Message-ID:Resent-To: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=tIKs6jqXEfhDhpIHvmwXjJkAvTYWy6ANiF4bXF6Nzox9bR/3RhzpZ44zCxpX4r nEJkVcSDzuE5pSJgfJn6u1JyAtBXei/diNn5BcbeNSYoSh238IE9wuzc5cTwoKFF pjJ0bctL4ju82fSQPXbuXjhOzYx4Ec57hzFObbTCymvg4=; Received: (qmail 26356 invoked by alias); 16 Oct 2012 15:22:47 -0000 Received: (qmail 26348 invoked by uid 22791); 16 Oct 2012 15:22:45 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS 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; Tue, 16 Oct 2012 15:22:41 +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.14.4/8.14.4) with ESMTP id q9GFMeDj001293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Oct 2012 11:22:41 -0400 Received: from zalov.redhat.com (vpn1-7-73.ams2.redhat.com [10.36.7.73]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9GFMdrK025386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 16 Oct 2012 11:22:40 -0400 Received: from zalov.cz (localhost [127.0.0.1]) by zalov.redhat.com (8.14.5/8.14.5) with ESMTP id q9GFMcTN005925; Tue, 16 Oct 2012 17:22:38 +0200 Received: (from jakub@localhost) by zalov.cz (8.14.5/8.14.5/Submit) id q9GFMcPo005924; Tue, 16 Oct 2012 17:22:38 +0200 Resent-From: Jakub Jelinek Resent-Date: Tue, 16 Oct 2012 17:22:38 +0200 Resent-Message-ID: <20121016152238.GL1727@tucnak.redhat.com> Resent-To: Jason Merrill , gcc-patches@gcc.gnu.org Date: Mon, 15 Oct 2012 17:04:25 +0200 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix sizeof related pt.c ICE (PR c++/54844) Message-ID: <20121015150425.GC584@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! Now that SIZEOF_EXPR isn't folded immediately, e.g. REAL_TYPE can be an argument of it, and tsubst_copy* doesn't handle that, but tsubst does. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2012-10-15 Jakub Jelinek PR c++/54844 * pt.c (tsubst_copy, tsubst_copy_and_build) : Use tsubst instead of tsubst_copy* on types. * g++.dg/template/sizeof14.C: New test. Jakub --- gcc/cp/pt.c.jj 2012-10-15 11:45:30.000000000 +0200 +++ gcc/cp/pt.c 2012-10-15 12:08:10.232364822 +0200 @@ -12104,8 +12104,8 @@ tsubst_copy (tree t, tree args, tsubst_f } if (SIZEOF_EXPR_TYPE_P (t)) { - r = tsubst_copy (TREE_TYPE (TREE_OPERAND (t, 0)), - args, complain, in_decl); + r = tsubst (TREE_TYPE (TREE_OPERAND (t, 0)), + args, complain, in_decl); r = build1 (NOP_EXPR, r, error_mark_node); r = build1 (SIZEOF_EXPR, tsubst (TREE_TYPE (t), args, complain, in_decl), r); @@ -13533,10 +13533,13 @@ tsubst_copy_and_build (tree t, { ++cp_unevaluated_operand; ++c_inhibit_evaluation_warnings; - op1 = tsubst_copy_and_build (op1, args, complain, in_decl, - /*function_p=*/false, - /*integral_constant_expression_p=*/ - false); + if (TYPE_P (op1)) + op1 = tsubst (op1, args, complain, in_decl); + else + op1 = tsubst_copy_and_build (op1, args, complain, in_decl, + /*function_p=*/false, + /*integral_constant_expression_p=*/ + false); --cp_unevaluated_operand; --c_inhibit_evaluation_warnings; } --- gcc/testsuite/g++.dg/template/sizeof14.C.jj 2012-10-15 12:01:41.596492966 +0200 +++ gcc/testsuite/g++.dg/template/sizeof14.C 2012-10-15 12:01:31.000000000 +0200 @@ -0,0 +1,4 @@ +// PR c++/54844 +// { dg-do compile } +template int fn () { return sizeof (double); } +int var = fn <0> ();