From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by sourceware.org (Postfix) with ESMTP id D92C5388E83C for ; Tue, 16 Jun 2020 16:06:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D92C5388E83C Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-njTkXYCJOsumn5hCapia5g-1; Tue, 16 Jun 2020 12:06:20 -0400 X-MC-Unique: njTkXYCJOsumn5hCapia5g-1 Received: by mail-qt1-f200.google.com with SMTP id q21so17080727qtn.20 for ; Tue, 16 Jun 2020 09:06:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PlPdwRsMbJ/Krv8Pt07o6vtKNzJi0BqSGU2YFYnhFD0=; b=tUgomngbMA1QHKK5qI5g3SVxs/tpZDfEa6FJRHCvqlLpVTBV68agd4OzMjl9ZkWpDa Mp9lKnY2zEMMzSm7cTMI/Ti5vFo2a1BjzkU+nJEZsj+Pu8FCVmcHA7Lhk1Gs8MbMBqO9 p0ZXoMBptz5JE5NeRI0P9UgQYtqG3NyHvu7dORR2oRl94MgzeCNEiaCAswYJtrqeRSeR FPv9n+7IVeqa5ProMm/22Wf9HrdErtqccCSI3PTMe+9ifmhvaty7wvsz22oUls+OC2yJ eRpJ+Z8UV4IChNLIdwrifxFzacFCI2MjscbeeECBynBR6x8bvdxt52z5skMJLxgfBzmN DxhQ== X-Gm-Message-State: AOAM532nKWfEWLhrHN6siixR0HC4nXwU6PSlqvIQmulmRws4RjZEvzOU NaVaopH1ojAt9cuoxhlduVnlTulWH0BwxKY6840O9rBojgVOpXF4szrmlOEQhYZY+nIIKxFvCiM cuUCuS7EF1Grw8L1LbQ== X-Received: by 2002:a37:aa81:: with SMTP id t123mr21803452qke.11.1592323579241; Tue, 16 Jun 2020 09:06:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6Ic0Il7/lJQltz0qb2vv3HQMQzc+B3zjdOj0PQ8/xm6L17ooMGHOMdZXo0Iyd7l+8BWvN/Q== X-Received: by 2002:a37:aa81:: with SMTP id t123mr21803428qke.11.1592323578960; Tue, 16 Jun 2020 09:06:18 -0700 (PDT) Received: from [192.168.1.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id p6sm15855857qtd.91.2020.06.16.09.06.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 Jun 2020 09:06:18 -0700 (PDT) Subject: Re: [PATCH] c++: Fix ICE in check_local_shadow with enum [PR95560] To: Marek Polacek Cc: GCC Patches References: <20200610211148.1237792-1-polacek@redhat.com> <658d4558-d53b-fcad-9dc0-43e09e04e6a1@redhat.com> <20200616012026.GJ53126@redhat.com> From: Jason Merrill Message-ID: Date: Tue, 16 Jun 2020 12:06:17 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200616012026.GJ53126@redhat.com> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.8 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 16:06:26 -0000 On 6/15/20 9:20 PM, Marek Polacek wrote: > On Thu, Jun 11, 2020 at 03:32:14PM -0400, Jason Merrill wrote: >> On 6/10/20 5:11 PM, Marek Polacek wrote: >>> Another indication that perhaps this warning is emitted too early. We >>> crash because same_type_p gets a null type: we have an enumerator >>> without a fixed underlying type and finish_enum_value_list hasn't yet >>> run. So check if the type is null before calling same_type_p. >> >> Hmm, I wonder why we use NULL_TREE for the type of uninitialized enumerators >> in a template; why not give them integer_type_node temporarily? > > That breaks enum22.C: > > template > struct A { > enum e_ : unsigned char { Z_, E_=sizeof(Z_) }; > }; > > static_assert ( A::E_ == 1, "E_ should be 1"); > > If we give 'Z_' a type, it's no longer instantiation-dependent, so sizeof(Z_) > immediately evaluates to 4. Whereas if it doesn't have a type, in the template > we create a SIZEOF_EXPR and only evaluate when instantiating (to 1). > > This sounded like a problem big enough for me not to pursue this any further. > Do you want me to try anything else or is the original patch ok? The original patch is OK, thanks. Jason