From patchwork Wed Sep 19 14:42:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 971741 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-485961-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="iktrIdf9"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="kw/KeAzl"; 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 42FjJl2xCVz9sBv for ; Thu, 20 Sep 2018 00:43:02 +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=EUZI+Jh4UCWwJRLaYX3DoCCme3ati1ALxarndyhvY8AryiIbwH g/RFdthhR8Ye1ku84Pkg2cPIT1zgfhqmdVGGI7PcdxoZAV4hhahWqtaxZlMzvBSa Iw8GFR9P+dKKuGdwofM6ZvB+3mJxZLeSd6o3NCCXUmNkB4XEUaddKbOCU= 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=h+CtThTvuyPXSXQ1UcHo7mV93bg=; b=iktrIdf9v0ktCE67dheh NVxUE8CAuxwlLqkdY5ac5ur2Bc0dM+alNwYTeKudy5RHY3h5xcEUhoMgtOeyRLsC +qtp2ijnZwi6K2VcOQX6pFtxbNMRBg0/WWgjmWvorYtUQcvFM0CZjyNqoCSjSnLH MSI3k9BG2aFj96y8CrttCJk= Received: (qmail 123300 invoked by alias); 19 Sep 2018 14:42:55 -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 123276 invoked by uid 89); 19 Sep 2018 14:42:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-16.1 required=5.0 tests=BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=boo X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Sep 2018 14:42:52 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w8JEdSXT005878; Wed, 19 Sep 2018 14:42:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=to : cc : from : subject : message-id : date : mime-version : content-type; s=corp-2018-07-02; bh=IKxaVjlEvWBdCC6ihlBfp303hqT8TGGA5FKzbC5Zm/M=; b=kw/KeAzlxO+Wsp5JRB7S11diCw4IhhHWsrxPjY1zM9cf3qDghdyEgxwR4M0CzNtcyphI Ac/uBNzUWybBAwdnuY3OQ51h/+4l2Zm9tI3IXkRFIEWkVR0UBWCQ/25UsyTOS3FZPxFp Zxw4R4CnMkI7Qu+TPpdv7fIt3VkWqx2Y5ZZAZ0CK4m3B54dSMj9LYDRvkTMKxSmqoneF xTv/CQglmGXmJFblNkiOiFsBHScdOIzvznC2UpTXO5bjGDqMpL6k/Uc7E+7Nnusg/f+5 ccuCZ5Hr/K0ox6yUxGUfHETxrjR0OnA0eSNu2k9OH6RHDjsNlnv0JL9qAyxRlreLUf1J 0w== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2mgsgtugbd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Sep 2018 14:42:50 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w8JEgneb010217 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Sep 2018 14:42:49 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w8JEgm6d007068; Wed, 19 Sep 2018 14:42:49 GMT Received: from [192.168.1.4] (/87.17.223.83) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Sep 2018 07:42:47 -0700 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 87324 ("g++ ICE with overriding initializers: Segmentation fault") Message-ID: Date: Wed, 19 Sep 2018 16:42:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, in this simple error-recovery issue we ICE in get_class_binding_direct when we try to use IDENTIFIER_CONV_OP_P on the index which we nulled in cp_parser_initializer_list. If, instead, we assign error_mark_node to it we catch it later in reshape_init_class and error-recovery goes well. Tested x86_64-linux. Thanks, Paolo. //////////////////// /cp 2018-09-19 Paolo Carlini PR c++/87324 * parser.c (cp_parser_initializer_list): Assign error_mark_node to the index upon error. /testsuite 2018-09-19 Paolo Carlini PR c++/87324 * g++.dg/cpp0x/desig5.C: New. Index: cp/parser.c =================================================================== --- cp/parser.c (revision 264419) +++ cp/parser.c (working copy) @@ -22394,7 +22394,7 @@ cp_parser_initializer_list (cp_parser* parser, boo "%<.%s%> designator used multiple times in " "the same initializer list", IDENTIFIER_POINTER (designator)); - (*v)[i].index = NULL_TREE; + (*v)[i].index = error_mark_node; } else IDENTIFIER_MARKED (designator) = 1; Index: testsuite/g++.dg/cpp0x/desig5.C =================================================================== --- testsuite/g++.dg/cpp0x/desig5.C (nonexistent) +++ testsuite/g++.dg/cpp0x/desig5.C (working copy) @@ -0,0 +1,13 @@ +// PR c++/87324 +// { dg-do compile { target c++11 } } +// { dg-options "-Wno-pedantic" } + +struct { + struct { + double a; + struct { + short b; + }; + }; + int c; +} d{.a = 7, .a = 8.09}; // { dg-error "designator used multiple times in the same initializer list" }