This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: alias.c:nonoverlapping_component_refs_p
- From: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- To: Richard Henderson <rth at redhat dot com>,Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>,gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Dec 2001 22:39:29 +0000
- Subject: Re: alias.c:nonoverlapping_component_refs_p
- References: <10112031254.AA08406@vlsi1.ultra.nyu.edu> <20011203140445.F7212@redhat.com>
Richard Henderson wrote:-
> Hum. I'd have thought variant records would have been implemented via
> nested RECORD and UNION types. Loosely,
>
> type Thread_Attributes (Bound_To_Sproc : Boolean) is
> record
> Thread_Resources : Resource_Vector_T := NO_RESOURCES;
> Thread_Timeslice : Duration := 0.0;
> case Bound_To_Sproc is
> when False =>
> null;
> when True =>
> Sproc : sproc_t;
> end case;
> end record;
>
> might be represented as
>
> typedef struct {
> Resource_Vector_T Thread_Resources;
> Duration Thread_Timeslice;
> Boolean Bound_To_Sproc;
> union {
> struct {
> } f;
> struct {
> sproc_t Sproc;
> } t;
> } u;
> } Thread_Attributes;
>
> where the compiler automatically transforms
>
> Thread_Attributes.Sproc
>
> to
>
> Thread_Attributes.u.t.Sproc
>
> plus whatever sanity checking vs Bound_To_Sproc are required
> by the language.
I thought so too; particularly now we have working anonymous unions,
modulo a minor PR of Joseph's.
Neil.