From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5320B3858CD1 for ; Thu, 20 Jul 2023 21:58:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5320B3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689890332; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iUSqGeQHusE71wqs+ezw6FVCsLVEiQ9GhnIx0dhg9xs=; b=GKp6ngp2F8RA0Kr+FeH/tf56UyVJ8PF5d+12z2DJqkwtC+27s6KuhHWIZO+VkpXeCZ9PDC y2w8uK6fIsbAWFEk8TEn5lAiDt2BjIqUZdej17MnWgpX5eCA55okfogX/7X8B/G22qqQhZ 39rIDugWEemwzXmWFgZtqI7LEeCDN9c= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-hichsxSHOSajjKjBTibcQw-1; Thu, 20 Jul 2023 17:58:51 -0400 X-MC-Unique: hichsxSHOSajjKjBTibcQw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7673e4eee45so159837585a.0 for ; Thu, 20 Jul 2023 14:58:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689890331; x=1690495131; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iUSqGeQHusE71wqs+ezw6FVCsLVEiQ9GhnIx0dhg9xs=; b=jZcTDSE3pr2nI5vIfNM0HooBxU7Ua2hP/Y0rJsbDHhrxh4YjvYK7NZvFwdGJxY6eQh YigHc3gd3VwxU+4PjwObj9L+/YYBmyHoI/JjQrVFDsgOqTpoiav5jvT2zHpCIa2ruSns eRkKbOqBEPErlJcjgJMnlQKbtBmD5AQWJXv2ObpTKvgUTx+NTxpPSt7dXZRZYoP1dLKv /HmaF2/khyb0PcF4ZCX6DdZOiBJz5sqm5IfXT+VUh5SCHy1WC8BIJ4H6dx1qeLDMAX1l 2wntDY3HhnucdAs9NainJmvatX7OpOFopVBVnMmoejBwTeqA00kyzIFDiCipymHLXYth BMOA== X-Gm-Message-State: ABy/qLYfZm3iRtB/GPY6EOIU1kQZygJVRwwNKnGX+GKZxDmn5bqbd8Yg 7BU13IslXdplSBgrl+tDkDSqwJmMqoOWmhda2rMMaZ3SR4OPlAaEDMW6I0AZeQCAD4b5X5oURRl kRaoyuMlRC13dqAu2vg== X-Received: by 2002:a05:620a:4090:b0:767:2e5a:cc with SMTP id f16-20020a05620a409000b007672e5a00ccmr7397qko.26.1689890330806; Thu, 20 Jul 2023 14:58:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFdvflp+d/nvw7goeEkliiY55EnI5Cppa1K16CctfKOL1pBM0RQ0iJHZvCOBEeJACqcGjKedg== X-Received: by 2002:a05:620a:4090:b0:767:2e5a:cc with SMTP id f16-20020a05620a409000b007672e5a00ccmr7387qko.26.1689890330531; Thu, 20 Jul 2023 14:58:50 -0700 (PDT) Received: from redhat.com (2603-7000-9500-34a5-0000-0000-0000-1db4.res6.spectrum.com. [2603:7000:9500:34a5::1db4]) by smtp.gmail.com with ESMTPSA id oo22-20020a05620a531600b00762f37b206dsm647084qkn.81.2023.07.20.14.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 14:58:50 -0700 (PDT) Date: Thu, 20 Jul 2023 17:58:48 -0400 From: Marek Polacek To: Jason Merrill Cc: Patrick Palka , GCC Patches Subject: Re: [PATCH] c++: fix ICE with is_really_empty_class [PR110106] Message-ID: References: <20230718211458.858343-1-polacek@redhat.com> <7007162f-c356-cbde-575e-1cbbd545323d@idea> <03d798a6-0951-1d11-5ae4-476e85f5636e@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.9 (2022-11-12) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-6.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Jul 20, 2023 at 03:51:32PM -0400, Marek Polacek wrote: > On Thu, Jul 20, 2023 at 02:37:07PM -0400, Jason Merrill wrote: > > On 7/20/23 14:13, Marek Polacek wrote: > > > On Wed, Jul 19, 2023 at 10:11:27AM -0400, Patrick Palka wrote: > > > > On Tue, 18 Jul 2023, Marek Polacek via Gcc-patches wrote: > > > > > > > > > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk and branches? > > > > > > > > Looks reasonable to me. > > > > > > Thanks. > > > > Though I wonder if we could also fix this by not checking potentiality > > > > at all in this case? The problematic call to is_rvalue_constant_expression > > > > happens from cp_parser_constant_expression with 'allow_non_constant' != 0 > > > > and with 'non_constant_p' being a dummy out argument that comes from > > > > cp_parser_functional_cast, so the result of is_rvalue_constant_expression > > > > is effectively unused in this case, and we should be able to safely elide > > > > it when 'allow_non_constant && non_constant_p == nullptr'. > > > > > > Sounds plausible. I think my patch could be applied first since it > > > removes a tiny bit of code, then I can hopefully remove the flag below, > > > then maybe go back and optimize the call to is_rvalue_constant_expression. > > > Does that sound sensible? > > > > > > > Relatedly, ISTM the member cp_parser::non_integral_constant_expression_p > > > > is also effectively unused and could be removed? > > > > > > It looks that way. Seems it's only used in cp_parser_constant_expression: > > > 10806 if (allow_non_constant_p) > > > 10807 *non_constant_p = parser->non_integral_constant_expression_p; > > > but that could be easily replaced by a local var. I'd be happy to see if > > > we can actually do away with it. (I wonder why it was introduced and when > > > it actually stopped being useful.) > > > > It was for the C++98 notion of constant-expression, which was more of a > > parser-level notion, and has been supplanted by the C++11 version. I'm > > happy to remove it, and therefore remove the is_rvalue_constant_expression > > call. > > Wonderful. I'll do that next. I found a use of parser->non_integral_constant_expression_p: finish_id_expression_1 can set it to true which then makes a difference in cp_parser_constant_expression in C++98. In cp_parser_constant_expression we set n_i_c_e_p to false, call cp_parser_assignment_expression in which finish_id_expression_1 sets n_i_c_e_p to true, then back in cp_parser_constant_expression we skip the cxx11 block, and set *non_constant_p to true. If I remove n_i_c_e_p, we lose that. This can be seen in init/array60.C. Marek