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