On Tue, Mar 28, 2023 at 10:50 PM Jakub Jelinek <ja...@redhat.com> wrote: > > On Tue, Mar 28, 2023 at 10:32:28PM +1100, Nathaniel Shead via Gcc-patches > wrote: > > * tree-core.h (struct tree_decl_common): New flag to check if > > value lifetime has expired. > > * tree.h (DECL_EXPIRED): Access the new flag. > > * print-tree.cc (print_node): Print the new flag. > > --- a/gcc/tree-core.h > > +++ b/gcc/tree-core.h > > @@ -1834,7 +1834,10 @@ struct GTY(()) tree_decl_common { > > /* In FIELD_DECL, this is DECL_NOT_FLEXARRAY. */ > > unsigned int decl_not_flexarray : 1; > > > > - /* 13 bits unused. */ > > + /* In VAR_DECL, PARM_DECL, or RESULT_DECL, this is DECL_EXPIRED. */ > > + unsigned int decl_expired_flag : 1; > > + > > + /* 12 bits unused. */ > > > > /* UID for points-to sets, stable over copying from inlining. */ > > unsigned int pt_uid; > > --- a/gcc/tree.h > > +++ b/gcc/tree.h > > @@ -2697,6 +2697,12 @@ extern tree vector_element_bits_tree (const_tree); > > ??? Need to figure out some way to check this isn't a PARM_DECL. */ > > #define DECL_INITIAL(NODE) (DECL_COMMON_CHECK (NODE)->decl_common.initial) > > > > +/* Used in a VAR_DECL, PARM_DECL, or RESULT_DECL to indicate whether > > + this declaration is currently in lifetime for constant evaluation > > + purposes. */ > > +#define DECL_EXPIRED(NODE) \ > > + (DECL_COMMON_CHECK(NODE)->decl_common.decl_expired_flag) > > + > > /* Holds the size of the datum, in bits, as a tree expression. > > Need not be constant and may be null. May be less than TYPE_SIZE > > for a C++ FIELD_DECL representing a base class subobject with its > > While it is true that tree_decl_common has some spare bits, this support > is for an implementation detail of the C++ FE and as such, I think it is > highly preferred to use some bit in the lang specific data structures > rather than wasting bits that we could need later on for things that will > be needed in the middle-end. > struct lang_decl_base I think also has 12 spare bits... > > Rest I'll defer to C++ maintainers (also whether this is appropriate now > or should be deferred for GCC 14 stage1). > > Jakub >
Thanks, I didn't notice that there were lang specific data structures; I'll take a look at using that instead. >From my point of view I was expecting this would be too late for GCC13 (especially since it should only affect already invalid code, and the risk of false positives), but I'm happy either way.