From patchwork Fri Apr 20 17:46:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 902082 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-476686-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="mbib1c9H"; 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 40SNb8554rz9s1X for ; Sat, 21 Apr 2018 03:47:00 +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=ghYzkFmydy/LZrBAf1dANveV3gEtZUX4qozyL3AA8N6blTXoEU U/HbL2A0D6/pxVZrkJLu2xbrbXhm+kD7OvyAaYoA8tMQ+kHDDrF0lIdQSx6nZa99 oxtmcEWu64n02VjL2rs3b0FoDzIhOX/5YfJBtEuFlGPi8UJzrardRIROg= 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=T97J3K/s+CxATsXcmDEReQnZs6Y=; b=mbib1c9HKPqADR45fCCk UG3ds/JcBKbv5NBcvifUke7snWZUEqk3qkUpf5AmQqZpzGQq3Dn6nsSsJwx2CVh6 yF4YXDhkBRhyrncCAHV/dq8lLLNMXcozUc/tdpmX/I15eJrrmOG1LNk/7a+KSM5J MCo7iaXl2Xxlwdx/Z76xBT4= Received: (qmail 65246 invoked by alias); 20 Apr 2018 17:46:53 -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 65236 invoked by uid 89); 20 Apr 2018 17:46:52 -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*RU:192.168.1.4, H*r:ip*192.168.1.4, Hx-spam-relays-external:192.168.1.4 X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 20 Apr 2018 17:46:51 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w3KHkOos165441; Fri, 20 Apr 2018 17:46:49 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2hdrxpdrg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Apr 2018 17:46:48 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w3KHkmFP013792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Apr 2018 17:46:48 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w3KHkl75006498; Fri, 20 Apr 2018 17:46:47 GMT Received: from [192.168.1.4] (/62.211.207.61) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 20 Apr 2018 10:46:47 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 84588 ("[8 Regression] internal compiler error: Segmentation fault (contains_struct_check())") Message-ID: Date: Fri, 20 Apr 2018 19:46:44 +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=8869 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-1804200178 X-IsSubscribed: yes Hi, in this error-recovery regression, after sensible diagnostic about "two or more data types in declaration..." we get confused, we issue a cryptic -  but useful hint to somebody working on the present bug ;) - "template definition of non-template" error and we finally crash. I think the issue here is that we want to use abort_fully_implicit_template as part of the error recovery done by cp_parser_parameter_declaration_list, when the loop is exited early after a cp_parser_parameter_declaration internally called synthesize_implicit_template_parm. Indeed, if we do that we get the same error recovery behavior we get for the same testcase modified to not use an auto parameter (likewise for related testcases): struct a {   void b() {}    void c(auto = [] {     if (a a(int int){})       ;   }) {} }; Tested x86_64-linux. Thanks, Paolo. /////////////////// /cp 2018-04-20 Paolo Carlini PR c++/84588 * parser.c (cp_parser_parameter_declaration_list): When the entire parameter-declaration-list is erroneous maybe call abort_fully_implicit_template. /testsuite 2018-04-20 Paolo Carlini PR c++/84588 * g++.dg/cpp1y/pr84588.C: New. Index: cp/parser.c =================================================================== --- cp/parser.c (revision 259516) +++ cp/parser.c (working copy) @@ -21358,6 +21358,8 @@ cp_parser_parameter_declaration_list (cp_parser* p { *is_error = true; parameters = error_mark_node; + if (parser->fully_implicit_function_template_p) + abort_fully_implicit_template (parser); break; } Index: testsuite/g++.dg/cpp1y/pr84588.C =================================================================== --- testsuite/g++.dg/cpp1y/pr84588.C (nonexistent) +++ testsuite/g++.dg/cpp1y/pr84588.C (working copy) @@ -0,0 +1,10 @@ +// { dg-do compile { target c++14 } } +// { dg-options "-w" } + +struct a { + void b() {} + void c(auto = [] { + if (a a(int auto){}) // { dg-error "two or more data types" } + ; + }) {} +};