From patchwork Mon Feb 25 15:27:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 1047774 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-496980-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=oracle.com 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 447Qn05tdqz9s2R for ; Tue, 26 Feb 2019 02:27:46 +1100 (AEDT) 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=T/Td+jEtuwtdL2fZo5AJU7fJouA8a2a5i+sjcrXjXipexz+Doc mHoY0qnx+p/xYmGO8wAzls629flpRamS0Blt0QFRntFGfh07x24DlJAnCyjoKbuT U5tzkIHWmlkUP3jBylq1VI9JUOUlO0APNIVjm8miMKgs8bczB8H/QwkdY= 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=KzdD6VjMkApPhUpDV1ZAgPSIoTE=; b=ETQu2t6s4Gu+x7zBTn2M euXqDoetKpFLImqi4qL+FwBk9pGsnDkqmfdh/IrGcgSjHGC7/UGGsK42Hoybmkc6 W5dbqUHqEYm5+X90F0D/nUmCrbtAVUuOEo4ne5+KBa/zn+T1kUQnWSG2XDqASO8f 6V+0WYytU856TTNUX6rbZxY= Received: (qmail 31210 invoked by alias); 25 Feb 2019 15:27:39 -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 31193 invoked by uid 89); 25 Feb 2019 15:27:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.1 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=proceeds, H*r:Gateway, Hx-languages-length:2268 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; Mon, 25 Feb 2019 15:27:37 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1PFO8Nh181901; Mon, 25 Feb 2019 15:27:35 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=vIy94cHpC/drQZwQVus5bpXxvWAdoQnhBOOKP/FNXCo=; b=BkXHG8GSi0EvvfGpXVFArnVNoL8y/wCZhQnCF+A8BASRdENV/2jua00dWWdqcoanCnLU eyGucn3fD1zatXV6i2x240JyyIhJm2DB/8RytwuyTUG1Wp1kJ+DY4Te63geg+1pJI4Vf XenxVenT4UkCwVWrMBCTlP7rz24Oc4ImgUgpZjTeKYvOJKH/9Oy12bgf3l366gZZ3hOS rkI9W6K+QDnq3Om+C71yytjIod+NOIV75hg5ahBs0rjklXigrU07tP7uFfL/JMPlfp6U LGC2/Awnw9abWYGLyafypokoCVtvqZ+k7SzvdtdKzB7URduS1KBIgZMqfKyuStvOISmA Zg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2qtwktxr4a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Feb 2019 15:27:35 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x1PFRU2t003711 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Feb 2019 15:27:30 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1PFRTwg001266; Mon, 25 Feb 2019 15:27:29 GMT Received: from [192.168.1.4] (/79.19.31.237) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 25 Feb 2019 07:27:26 -0800 To: "gcc-patches@gcc.gnu.org" Cc: Jason Merrill From: Paolo Carlini Subject: [C++ Patch] PR 89488 ("[9 Regression] ICE in merge_exception_specifiers, at cp/typeck2.c:2395") Message-ID: <27d0753f-39f8-b80b-d92d-86ce7163ea23@oracle.com> Date: Mon, 25 Feb 2019 16:27:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi, this error recovery regression has to do with the recent changes committed by Jason for c++/88368. What happens is that maybe_instantiate_noexcept fails the hard way, thus, toward the end of the function, doesn't update TREE_TYPE (fn) and just returns false. process_subob_fn doesn't notice and proceeds to call merge_exception_specifiers anyway where of course the gcc_assert (!DEFERRED_NOEXCEPT_SPEC_P (add)) triggers, because maybe_instantiate_noexcept has not done its normal job. To improve error-recovery I think we can simply leave *spec_p alone in such cases, because we would merge the *spec_p with a TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)) where TREE_TYPE (fn) has not been normally computed. I tried a few other things which prima facie looked sensible but nothing else worked - eg, returning false from maybe_instantiate_noexcept and also updating TREE_TYPE (fn) to a noexcept_false_spec variant causes regressions exactly for the testcases of c++/88368. Tested x86_64-linux. Thanks, Paolo. //////////////////////// /cp 2019-02-25 Paolo Carlini PR c++/89488 * method.c (process_subob_fn): When maybe_instantiate_noexcept returns false don't call merge_exception_specifiers. /testsuite 2019-02-25 Paolo Carlini PR c++/89488 * g++.dg/cpp0x/nsdmi15.C: New. Index: cp/method.c =================================================================== --- cp/method.c (revision 269187) +++ cp/method.c (working copy) @@ -1254,9 +1254,8 @@ process_subob_fn (tree fn, tree *spec_p, bool *tri return; } - if (spec_p) + if (spec_p && maybe_instantiate_noexcept (fn)) { - maybe_instantiate_noexcept (fn); tree raises = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (fn)); *spec_p = merge_exception_specifiers (*spec_p, raises); } Index: testsuite/g++.dg/cpp0x/nsdmi15.C =================================================================== --- testsuite/g++.dg/cpp0x/nsdmi15.C (nonexistent) +++ testsuite/g++.dg/cpp0x/nsdmi15.C (working copy) @@ -0,0 +1,8 @@ +// PR c++/89488 +// { dg-do compile { target c++11 } } + +struct zl { + struct { + int x2 = zl (); // { dg-error "default member|cannot convert" } + } fx; +};