From: Jason Merrill <jason@redhat.com>
To: Roger Sayle <roger@nextmovesoftware.com>, gcc-patches@gcc.gnu.org
Subject: Re: [C++ PATCH] PR c++/96442: Another improved error recovery in enumerations.
Date: Thu, 10 Mar 2022 00:05:50 -0500 [thread overview]
Message-ID: <9934941b-5b91-328f-b9de-d46a1ad9be12@redhat.com> (raw)
In-Reply-To: <001701d827e4$18186bb0$48494310$@nextmovesoftware.com>
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 <roger@nextmovesoftware.com>
>
> 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
> --
>
prev parent reply other threads:[~2022-03-10 5:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 12:02 Roger Sayle
2022-03-10 5:05 ` Jason Merrill [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9934941b-5b91-328f-b9de-d46a1ad9be12@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=roger@nextmovesoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).