From patchwork Thu Mar 3 16:11:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 85295 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 847D6B70F4 for ; Fri, 4 Mar 2011 03:14:19 +1100 (EST) Received: (qmail 14635 invoked by alias); 3 Mar 2011 16:14:14 -0000 Received: (qmail 14622 invoked by uid 22791); 3 Mar 2011 16:14:13 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet10.oracle.com (HELO rcsinet10.oracle.com) (148.87.113.121) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Mar 2011 16:14:07 +0000 Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p23GE3ZL024336 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 Mar 2011 16:14:05 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p23GE05j018510; Thu, 3 Mar 2011 16:14:00 GMT Received: from abhmt010.oracle.com by acsmt355.oracle.com with ESMTP id 1105983001299168714; Thu, 03 Mar 2011 08:11:54 -0800 Received: from [192.168.1.4] (/79.52.240.78) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 Mar 2011 08:11:54 -0800 Message-ID: <4D6FBDC8.5070504@oracle.com> Date: Thu, 03 Mar 2011 17:11:52 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101125 SUSE/3.0.11 Thunderbird/3.0.11 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] PR 47974 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, another ICE on invalid, 4.6 regression, a simple patch for it attached. Tested x86_64-linux. Ok? Thanks, Paolo. /cp 2011-03-03 Paolo Carlini PR c++/47974 * pt.c (tsubst_template_args): Check argument t for error_mark_node. /testsuite 2011-03-03 Paolo Carlini PR c++/47974 * g++.dg/template/crash106.C: New. Index: testsuite/g++.dg/template/crash106.C =================================================================== --- testsuite/g++.dg/template/crash106.C (revision 0) +++ testsuite/g++.dg/template/crash106.C (revision 0) @@ -0,0 +1,12 @@ +// PR c++/47974 + +typedef double T; + +struct A +{ + template void foo(); // { dg-error "type" } +}; + +template > struct B {}; // { dg-error "type|declared" } + +B<> b; // { dg-error "type|declaration" } Index: cp/pt.c =================================================================== --- cp/pt.c (revision 170651) +++ cp/pt.c (working copy) @@ -8966,10 +8966,15 @@ static tree tsubst_template_args (tree t, tree args, tsubst_flags_t complain, tree in_decl) { tree orig_t = t; - int len = TREE_VEC_LENGTH (t); - int need_new = 0, i, expanded_len_adjust = 0, out; - tree *elts = XALLOCAVEC (tree, len); + int len, need_new = 0, i, expanded_len_adjust = 0, out; + tree *elts; + if (t == error_mark_node) + return error_mark_node; + + len = TREE_VEC_LENGTH (t); + elts = XALLOCAVEC (tree, len); + for (i = 0; i < len; i++) { tree orig_arg = TREE_VEC_ELT (t, i);