public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Nathaniel Shead <nathanieloshead@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Patrick Palka <ppalka@redhat.com>
Subject: Re: [PATCH v3 1/3] c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675]
Date: Mon, 17 Jul 2023 12:04:43 -0400	[thread overview]
Message-ID: <3a6c21d8-4191-0008-e816-f6c4d6b00367@redhat.com> (raw)
In-Reply-To: <ZLP06W4SMTBu0rbB@Thaum.localdomain>

On 7/16/23 09:47, Nathaniel Shead wrote:
> On Fri, Jul 14, 2023 at 11:16:58AM -0400, Jason Merrill wrote:
>>
>> What if, instead of removing the variable from one hash table and adding it
>> to another, we change the value to, say, void_node?
> 
> I have another patch I'm working on after this which does seem to
> require the overlapping tables to properly catch uses of aggregates
> while they are still being constructed (i.e. before their lifetime has
> begun), as part of PR c++/109518. In that case the 'values' map contains
> the CONSTRUCTOR node for the aggregate, but it also needs to be in
> 'outside_lifetime'. I could also explore solving this another way
> however if you prefer.

I'd think to handle this with a flag on the CONSTRUCTOR to indicate that 
members with no value are out of lifetime (so, a stronger version of 
CONSTRUCTOR_NO_CLEARING that just indicates uninitialized).  Currently 
all the TREE_LANG_FLAG_* are occupied on CONSTRUCTOR, but there seem to 
be plenty of spare bits to add a TREE_LANG_FLAG_7.

It might make sense to access those two flags with accessor functions so 
they stay aligned.

> (I also have vague dreams of at some point making this a map to the
> location that the object was destroyed for more context in the error
> messages, but I'm not yet sure if that's feasible or will actually be
> all that helpful so I'm happy to forgo that.)

Hmm, that sounds convenient for debugging, but affected cases would also 
be straightforward to debug by adding a run-time call, so I'm skeptical 
it would be worth the overhead for successful compiles.

Jason


  reply	other threads:[~2023-07-17 16:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-01  3:24 [PATCH v3 0/3] c++: Track lifetimes in constant evaluation [PR70331,...] Nathaniel Shead
2023-07-01  3:28 ` [PATCH v3 1/3] c++: Track lifetimes in constant evaluation [PR70331,PR96630,PR98675] Nathaniel Shead
2023-07-14 15:16   ` Jason Merrill
2023-07-14 22:40     ` Jason Merrill
2023-07-16 13:47     ` Nathaniel Shead
2023-07-17 16:04       ` Jason Merrill [this message]
2023-07-01  3:30 ` [PATCH v3 2/3] c++: Improve constexpr error for dangling local variables Nathaniel Shead
2023-07-01  3:30 ` [PATCH v3 3/3] c++: Improve location information in constant evaluation Nathaniel Shead
2023-07-10 19:23 ` [PATCH v3 0/3] c++: Track lifetimes in constant evaluation [PR70331,...] Patrick Palka

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=3a6c21d8-4191-0008-e816-f6c4d6b00367@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=nathanieloshead@gmail.com \
    --cc=ppalka@redhat.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).