This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Semantics of CONSTRUCTOR tree nodes


What are the exact semantics of CONSTRUCTOR tree nodes meant to be?  I
think that they are not meant to be the same as C99 compound literals -
and so compound literals ought to use a new tree node which wraps around a
CONSTRUCTOR and provides the appropriately initialised object (an
anonymous VAR_DECL initialised by the CONSTRUCTOR, probably) with
appropriate storage duration required by C99, but some questions about the
CONSTRUCTORs:

1. Is it intended that multiple CONSTRUCTORs with identical contents can
share the same memory?

2. Is it undefined behavior if the memory occupied by a CONSTRUCTOR gets
modified at runtime?

3. What is the storage duration of memory occupied by a CONSTRUCTOR?

Related:

4. What is the right way to allow a const-qualified compound literal with
constant contents to share memory with other such compound literals or
strings?  (Whereas user variables can't, these const-qualified compound
literals can.)

For compound literals, 1) memory can only be shared if they are
const-qualified; 2) they can be modified (if not const-qualified); 3) the
storage duration is that associated with the enclosing block.

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]