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]

Re: Semantics of CONSTRUCTOR tree nodes


Joseph S. Myers wrote:

>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 -
>
I don't know what 'C99 compound literals' are - but CONSTRUCTORs are 
meant to
be encode a brace-initializer-lists in standard C.

A CONSTRUCTOR is an rvalue, not a variable.  It has a type.

>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:
>
That sounds wrong.

>1. Is it intended that multiple CONSTRUCTORs with identical contents can
>share the same memory?
>
The question is meaningless.  CONSTRUCTORs do not have memory.
It is like asking if multiple PLUS_EXPRs can share the same memory.

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

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

    --Per Bothner




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