This is the mail archive of the
mailing list for the GCC project.
Re: Question on gimplify.c:create_tmp_var
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 6 Jun 2004 12:19:34 -0700
- Subject: Re: Question on gimplify.c:create_tmp_var
- References: <10406061803.AA01016@vlsi1.ultra.nyu.edu>
On Sun, Jun 06, 2004 at 02:03:48PM -0400, Richard Kenner wrote:
> Why are you using VIEW_CONVERT_EXPR on something other than scalars?
> Let me give you a typical example. Suppose I have the following types
> and data object in Ada:
> type r1 (d : boolean := false) is record
> case d is
> when false =>
> f1: integer;
> when true =>
> f2: integer;
> f3: integer;
> end case;
> end record;
> type r2 is record
> f4: integer;
> f5: r1;
> end record;
> x : r2;
> The type of f5 isn't really r1, but is an special subtype of r1 which has a
> fixed size (the maximum size). But if I say x.f5, that *does* have the type
> "r1", not the special type (this is Ada semantics). So there's a
> VIEW_CONVERT_EXPR going on.
This seems to me to be a huge representational mistake.
It seems to me that this is best represented using a temporary structure
internal to the compiler, r1_prime, which is has the maximum size of r1
and contains a single field of type r1. Then when you write "x.f5" at the
source level, the compiler actually generates "x.f5.real_r1".
No muss, no fuss, no disgusting things happening with lvalue casts.
Further, it seems to me that it preserves the original language type
system better than whatever you've been doing before.