From: Jason Merrill <jason@redhat.com>
To: Nathaniel Shead <nathanieloshead@gmail.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: Check for indirect change of active union member in constexpr [PR101631]
Date: Wed, 30 Aug 2023 16:28:18 -0400 [thread overview]
Message-ID: <053faf76-f918-7527-4a41-755a18d0018a@redhat.com> (raw)
In-Reply-To: <ZO30PQql2TablzpJ@Thaum.localdomain>
On 8/29/23 09:35, Nathaniel Shead wrote:
> This is an attempt to improve the constexpr machinery's handling of
> union lifetime by catching more cases that cause UB. Is this approach
> OK?
>
> I'd also like some feedback on a couple of pain points with this
> implementation; in particular, is there a good way to detect if a type
> has a non-deleted trivial constructor? I've used 'is_trivially_xible' in
> this patch, but that also checks for a trivial destructor which by my
> reading of [class.union.general]p5 is possibly incorrect. Checking for a
> trivial default constructor doesn't seem too hard but I couldn't find a
> good way of checking if that constructor is deleted.
I guess the simplest would be
(TYPE_HAS_TRIVIAL_DFLT (t) && locate_ctor (t))
because locate_ctor returns null for a deleted default ctor. It would
be good to make this a separate predicate.
> I'm also generally unsatisfied with the additional complexity with the
> third 'refs' argument in 'cxx_eval_store_expression' being pushed and
> popped; would it be better to replace this with a vector of some
> specific structure type for the data that needs to be passed on?
Perhaps, but what you have here is fine. Another possibility would be
to just have a vec of the refs and extract the index from the ref later
as needed.
Jason
next prev parent reply other threads:[~2023-08-30 20:28 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 13:35 Nathaniel Shead
2023-08-30 20:28 ` Jason Merrill [this message]
2023-09-01 12:22 ` [PATCH v2] c++: Catch " Nathaniel Shead
2023-09-17 12:46 ` Nathaniel Shead
2023-09-19 21:25 ` Jason Merrill
2023-09-20 0:55 ` Nathaniel Shead
2023-09-20 19:23 ` Jason Merrill
2023-09-21 13:41 ` [PATCH v3] " Nathaniel Shead
2023-09-22 13:21 ` Jason Merrill
2023-09-22 15:01 ` [PATCH v4] c++: Check for indirect change of active union member in constexpr [PR101631,PR102286] Nathaniel Shead
2023-09-23 0:38 ` Nathaniel Shead
2023-09-23 6:40 ` Jonathan Wakely
2023-09-23 7:30 ` [PATCH] libstdc++: Ensure active union member is correctly set Nathaniel Shead
2023-09-23 10:52 ` Jonathan Wakely
2023-09-27 14:13 ` Jonathan Wakely
2023-09-28 23:25 ` Nathaniel Shead
2023-09-29 9:32 ` Jonathan Wakely
2023-09-29 15:06 ` Jonathan Wakely
2023-09-29 16:29 ` Nathaniel Shead
2023-09-29 16:46 ` Jonathan Wakely
2023-10-21 14:45 ` Jonathan Wakely
2023-10-09 1:03 ` [PATCH v4] c++: Check for indirect change of active union member in constexpr [PR101631,PR102286] Nathaniel Shead
2023-10-09 20:46 ` Jason Merrill
2023-10-10 13:48 ` [PATCH v5] " Nathaniel Shead
2023-10-12 8:53 ` [PATCH v6] " Nathaniel Shead
2023-10-12 20:24 ` Jason Merrill
2023-10-12 22:05 ` Nathaniel Shead
2023-10-20 3:23 ` Jason Merrill
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=053faf76-f918-7527-4a41-755a18d0018a@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nathanieloshead@gmail.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).