[{"id":1765924,"web_url":"http://patchwork.ozlabs.org/comment/1765924/","msgid":"<CADzB+2mSWTGKj+xtb3f8Z1C18dZ637cPV4_q_J-JZHvFA_ourQ@mail.gmail.com>","list_archive_url":null,"date":"2017-09-10T09:19:50","subject":"Re: [C++ Patch] PR 70621 (\"[6/7/8 Regression] ICE on invalid code\n\tat -O1 and above on x86_64-linux-gnu in record_reference,\n\tat cgraphbuild.c:64\")","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"OK.\n\nOn Tue, Aug 29, 2017 at 11:33 AM, Paolo Carlini\n<paolo.carlini@oracle.com> wrote:\n> Hi,\n>\n> in this error recovery regression, we ICE only when optimizing, while\n> building the cgraph. Avoiding the reported problem seems easy, just check\n> the return value of duplicate_decls in start_decl and immediately return\n> back error_mark_node. However, while working on the issue, I noticed\n> something slightly more interesting, IMO: we have, after the relevant\n> duplicate_decls call:\n>\n> -              if (decl_spec_seq_has_spec_p (declspecs, ds_constexpr)\n> -                  && !DECL_DECLARED_CONSTEXPR_P (field))\n> -                error (\"%qD declared %<constexpr%> outside its class\",\n> field);\n>\n> which I propose to remove. In fact - something I didn't really know - for\n> well formed user code, duplicate_decls, near the end, does some memcpys\n> which mean that its second argument (would be 'field' in the start_decl\n> section we are looking at)  is adjusted to have a DECL_DECLARED_CONSTEXPR_P\n> consistent with its first argument. That's of course because we want to\n> accept snippets like:\n>\n> struct A\n> {\n>   static const int x;\n> };\n>\n> constexpr int A::x = 0;\n>\n> In turn that means the error above is issued only when something went wrong\n> in duplicate_decls in the first place. Thus the above error seems at least\n> verbose. However, here in start_decl we are only handling VAR_P (decl), thus\n> I don't think the message above even makes sense and could be misleading,\n> given snippets like the above. Therefore, I propose to remove the diagnostic\n> entirely, which overall also simplifies a patch dealing with c++/70621. The\n> below passes testing as-is on x86_64-linux.\n>\n> Thanks, Paolo.\n>\n> ////////////////////////\n>","headers":{"Return-Path":"<gcc-patches-return-461787-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461787-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"Phn92FIy\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xqls335xmz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 10 Sep 2017 19:20:23 +1000 (AEST)","(qmail 46102 invoked by alias); 10 Sep 2017 09:20:15 -0000","(qmail 46091 invoked by uid 89); 10 Sep 2017 09:20:14 -0000","from mail-it0-f49.google.com (HELO mail-it0-f49.google.com)\n\t(209.85.214.49) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSun, 10 Sep 2017 09:20:12 +0000","by mail-it0-f49.google.com with SMTP id v19so8650873ite.0 for\n\t<gcc-patches@gcc.gnu.org>; Sun, 10 Sep 2017 02:20:12 -0700 (PDT)","by 10.107.181.23 with HTTP; Sun, 10 Sep 2017 02:19:50 -0700 (PDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; q=dns; s=default; b=lYsYcC/PGeO9kKH\n\tEhm5Qg5jZbhOosi5EPwBrqVFriWWklpSAsAigC8P8fkDU8JCYQO4eaVc8aw/k1QT\n\toN59B9D5SC2AFmkPT6xRxNnmcb71I4CleQNnWqATYCQS20EWqGGhMtNXA8KBvPED\n\tnaKRiRmIg2BkgqjYkalifj3Pcpyo=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender\n\t:mime-version:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-type; s=default; bh=0sLYlQ79YoSAeQpGxTCjD\n\twZZ7Cg=; b=Phn92FIyZczFdCKJC6Hp6mPAkbQ35uGLsXE2MfbBz14hL3k2h8H+2\n\tN8zuzH5vC2oMHNOkkkHb31ln+8u8Nsd5XPLDNe1ksMAZMRM1UXeIkJiQUc86eEuc\n\t/BAOw+ZEzEJ6uWESI6OHXP7fOPMCXc8e0m4/uyz+2xASQR55hDXmKY=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-2.3 required=5.0 tests=AWL, BAYES_00,\n\tRCVD_IN_DNSWL_NONE,\n\tRCVD_IN_SORBS_SPAM autolearn=no version=3.3.2\n\tspammy=Hx-languages-length:1843","X-HELO":"mail-it0-f49.google.com","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net;\n\ts=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc;\n\tbh=1DkWBBq6lqSpLvbw1nXprIk+mGm8/oKaOGoAGnUN4Z0=;\n\tb=sWlhQOHnjNKQGc5Drrzz3kmKThuUUilusQcsGW5F3iVlqHYJpg935LpK0bgjgdBHah\n\tD6hA1L3/rebWZQlgsbrFgn1LT1jK65LFJ2IEltM2Il+iR/Qixo4oBVzAtuQ3jxtW5pbl\n\tQ0y671LZUP8YMlty/Im14sIBmwkCw+yGGONm9h4o0d26P+qZuSvfxjAaeacbX7eSTH/A\n\tsezJ9PZpiuzG1I1mxgRzkzoaB84633PCmrN2hJ7JfowO3fehYV8E149MfZAqGKJXVdMf\n\tSS0B6d5uPaZ8RhcxqIWtMDU0aZXCQzD0K7SbM++09orC9EiTDwAINLJz2HQNCy63S6vb\n\tgWgg==","X-Gm-Message-State":"AHPjjUgYYE5916+KfjXUWdSrl5z138ugO1OlXV9Agx3X+WfN8IqkdCXI\tdjox/eejbdrrJMY+FOk3yImI2gt716Pc","X-Google-Smtp-Source":"AOwi7QDjEGsVsJ4tebbWQXG15YAgfhrvRIU3KLLXQ551PXBNMt7Aa44J/UMqqVVHY91uKz+eHcpWdgIYioSJMxYNjUQ=","X-Received":"by 10.36.147.135 with SMTP id y129mr7792596itd.134.1505035211053;\n\tSun, 10 Sep 2017 02:20:11 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<7c782ea8-b832-3e1b-ce83-cca08866f4c8@oracle.com>","References":"<7c782ea8-b832-3e1b-ce83-cca08866f4c8@oracle.com>","From":"Jason Merrill <jason@redhat.com>","Date":"Sun, 10 Sep 2017 11:19:50 +0200","Message-ID":"<CADzB+2mSWTGKj+xtb3f8Z1C18dZ637cPV4_q_J-JZHvFA_ourQ@mail.gmail.com>","Subject":"Re: [C++ Patch] PR 70621 (\"[6/7/8 Regression] ICE on invalid code\n\tat -O1 and above on x86_64-linux-gnu in record_reference,\n\tat cgraphbuild.c:64\")","To":"Paolo Carlini <paolo.carlini@oracle.com>","Cc":"\"gcc-patches@gcc.gnu.org\" <gcc-patches@gcc.gnu.org>","Content-Type":"text/plain; charset=\"UTF-8\"","X-IsSubscribed":"yes"}}]