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 1B42A3858C2C for ; Thu, 10 Mar 2022 05:05:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1B42A3858C2C Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-418-9Cd9caRbMNGTakMFjLphgA-1; Thu, 10 Mar 2022 00:05:52 -0500 X-MC-Unique: 9Cd9caRbMNGTakMFjLphgA-1 Received: by mail-qk1-f200.google.com with SMTP id y140-20020a376492000000b0067b14129a63so3142627qkb.9 for ; Wed, 09 Mar 2022 21:05:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=9D8aTLsQDEbzvtEuKwS3soyGSZpjlHiwmwTuFDlBt9E=; b=j3tlbeK59y9HbidoWLYUv2zLuexSPqulecAKgBTq9ofTicT2bpyxWmWFxNbv7dRHu3 qYKCZMohtZlvfdwox2dJbxZ79MVHBwdX4YCuayXwNyMcnwInwzCr/A1dYzblXD6axs71 iVkIon2gnY1NOBCR7CYnJ9SgchGuVlUuVghKC8h3NWPhILzPGCF2IbuCnNa6/rw7qLWb BIE3z9PMOrjjMrcNtEiuu53VPA+oS2yMJ11DMNWmB/9pyAGGWYRNYqqESj3seu+lFVyB BBVoNFUUGZXu4UkaQVzYbWfAd7XTGwfXEfwKqHfJQvA5Fs2ngnp2JKQJd2tAB1GeOV/O jCHA== X-Gm-Message-State: AOAM532nqspFIODF0jCQKXZq7wEUFAGhxiqW+3PQwGhPbLGMWsCwsc43 +nMpHX5nvDp2Pl1gon62jJTbHJwPkrjEBkodBQj0RGwW9nz3N+bXBQE9+4R+Qwm84vZk/5s66m/ VFhYsNzboMb8NQsk4DQ== X-Received: by 2002:a05:622a:54b:b0:2e0:634d:1136 with SMTP id m11-20020a05622a054b00b002e0634d1136mr2567954qtx.494.1646888751791; Wed, 09 Mar 2022 21:05:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzonf43z4BflVI29PRqUcP0+T56jO6/QfTHm7z+Xm0ug1zRPcZLiCkmzVLG32GJQLVI2LgpWQ== X-Received: by 2002:a05:622a:54b:b0:2e0:634d:1136 with SMTP id m11-20020a05622a054b00b002e0634d1136mr2567943qtx.494.1646888751445; Wed, 09 Mar 2022 21:05:51 -0800 (PST) Received: from [192.168.1.149] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id v9-20020a05622a144900b002dfedb4dccasm2610032qtx.66.2022.03.09.21.05.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Mar 2022 21:05:50 -0800 (PST) Message-ID: <9934941b-5b91-328f-b9de-d46a1ad9be12@redhat.com> Date: Thu, 10 Mar 2022 00:05:50 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [C++ PATCH] PR c++/96442: Another improved error recovery in enumerations. To: Roger Sayle , gcc-patches@gcc.gnu.org References: <001701d827e4$18186bb0$48494310$@nextmovesoftware.com> From: Jason Merrill In-Reply-To: <001701d827e4$18186bb0$48494310$@nextmovesoftware.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 10 Mar 2022 05:05:56 -0000 On 2/22/22 08:02, Roger Sayle wrote: > > This patch resolves PR c++/96442, another ICE-after-error regression. > In this case, invalid code attempts to use a non-integral type as the > underlying type for an enumeration (a record_type in the example given > in the bugzilla PR), for which the parser emits an error message but > allows the inappropriate type to leak to downstream code. How does that happen? Would it help to change dependent_type_p in start_enum to WILDCARD_TYPE_P? > The minimal > safe fix is to double check that the enumeration's underlying type > EUTYPE satisfies INTEGRAL_TYPE_P before calling int_fits_type_p in > build_enumerator. This is a one line fix, but correcting indentation > and storing a common subexpression in a variable makes the change look > a little bigger. > > This patch has been tested on x86_64-pc-linunx-gnu with make bootstrap > and make -k check with no new (unexpected) failures. Ok for mainline? > > > 2022-02-22 Roger Sayle > > gcc/cp/ChangeLog > PR c++/96442 > * decl.cc (build_enumeration): Check ENUM_UNDERLYING_TYPE is > INTEGRAL_TYPE_P before calling int_fits_type_p. > > gcc/testsuite/ChangeLog > PR c++/96442 > * g++.dg/pr96442.C: New test cae. > > > Thanks in advance, > Roger > -- >