This is the mail archive of the 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: Question on gimplify.c:create_tmp_var

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

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.


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