From patchwork Thu Apr 19 08:25:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 900667 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-476603-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="tMP7eKms"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RX9k3Xmvz9s1P for ; Thu, 19 Apr 2018 18:25:29 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=MYtoknvWAbsilBYqIBtPnsiV6YYt6XIcTkw+Iu4acWzjdr9B8M e5FrElEYpJbTy3H/ArcWhMX5beCApJED8RyDFs3/JMNHquoeYBJjZpHxHQwI3u6R XvCkgP/F46p+p+1PDQUnX37ZYE6OpTdh8RoplODKlqH1Mm3PbCE/yDhe0= 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:to:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=RR1HOxp+7qxXs0fT2DfHXhR7zIk=; b=tMP7eKmsRVsjnKFWqol8 xsZb2q5HrW5a84OnB56jCTxueXhVBvmVmdUJvr4wJbWeYPW3nrmiGbuSNEFlYstp AdV4E86uD9qElnyZbmCSXJRSIjR1o0DnPK2th6C0TIzZAQfGZQvlLp/Zl5Rd2Fv9 qywLHl7uixWanJ7/My9opHc= Received: (qmail 39432 invoked by alias); 19 Apr 2018 08:25:22 -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 39421 invoked by uid 89); 19 Apr 2018 08:25:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:8.14.4, H*F:D*oracle.com, iceing, Hx-languages-length:2083 X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Apr 2018 08:25:20 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3J8Loqt012417; Thu, 19 Apr 2018 08:25:18 GMT Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2hdrxne6av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Apr 2018 08:25:18 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3J8PHK8001700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Apr 2018 08:25:17 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w3J8PGtB017905; Thu, 19 Apr 2018 08:25:17 GMT Received: from [192.168.1.4] (/62.211.207.61) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 19 Apr 2018 08:25:16 +0000 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84611 ("[6/7/8 Regression] ICE in operator[], at vec.h:826 (local_class_index())") Message-ID: <1d1c94a7-3b20-47b8-b477-aee3ac66bf35@oracle.com> Date: Thu, 19 Apr 2018 10:25:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8867 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1804190073 X-IsSubscribed: yes Hi, the below is a rather low-key fix for this error-recovery regression: simply notice that pushtag is returning error_mark_node and avoid ICEing later. IMHO opinion it's correct and we may as well have it for 8.1.0 but looking forward we really want a single error in such cases, probably by checking first the return value of cp_parser_check_type_definition in cp_parser_class_specifier_1. Unfortunately, not regressing in terms of error-recovery quality on, say, g++.old-deja/g++.jason/cond.C or g++.dg/parse/no-type-defn1.C seems pretty tough, I don't think it's 8.1.0 material. Tested x86-64-linux. Thanks! Paolo. ///////////////////// /cp 2018-04-19 Paolo Carlini PR c++/84611 * pt.c (lookup_template_class_1): Check pushtag return value for error_mark_node. /testsuite 2018-04-19 Paolo Carlini PR c++/84611 * g++.dg/parse/crash68.C: New. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 259462) +++ cp/pt.c (working copy) @@ -9444,7 +9444,9 @@ lookup_template_class_1 (tree d1, tree arglist, tr /* A local class. Make sure the decl gets registered properly. */ if (context == current_function_decl) - pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current); + if (pushtag (DECL_NAME (gen_tmpl), t, /*tag_scope=*/ts_current) + == error_mark_node) + return error_mark_node; if (comp_template_args (CLASSTYPE_TI_ARGS (template_type), arglist)) /* This instantiation is another name for the primary Index: testsuite/g++.dg/parse/crash68.C =================================================================== --- testsuite/g++.dg/parse/crash68.C (nonexistent) +++ testsuite/g++.dg/parse/crash68.C (working copy) @@ -0,0 +1,18 @@ +// PR c++/84611 + +template +struct a { + a() { + struct c; + try { + } catch (struct c {}) { // { dg-error "types may not be defined|conflicting" } + } + } +}; + +struct d { + d(); + a<> b; +}; + +d::d() {}