This is the mail archive of the gcc-patches@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: Patch: stab info for const fields




--On Thursday, October 31, 2002 04:38:15 PM +0000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:

    It would be great to get all this junk out of DECLs, but it will
    take some doing...

I'm still not sure it's moving in the right direction.  Consider the
following in Ada:

	type Myint is range 0..1000;
	for Myint'size use 32;
	type T is record f1, f2: Myint; end record;
	X: T;
	for X'size use 128;

This has X of type T, which is 64 bits, but X is 128 bits.

Currently, GNAT makes a special type for X which is a record of one
field.  That field is of type T and the type for X has a size of 128 bits.
Then X is of that type.

But doing this means that all references to X need an implicit
COMPONENT_REF to extract the actual data.  This is a mess.
Yes, but it's Ada's mess. :-)

GCC is pretty clear on the idea that the type system is, roughly
speaking, the C type system.  The front end's job is to translate
its own type system into that type system.

The current Ada approach is exactly the right one, in that respect.

There's no inherent reason that it should cause any problems; our
optimizers should be able to figure out what's going on.  If they
can't, they will be improved.

If you have declarations whose size is not that of their type, you
have to say more about what tree operations are legal in the middle
end.  Can you use a MODIFY_EXPR to assign these out-sized objects to
ordinary-sized objects?  Normally, the constraint on a MODIFY_EXPR
is that the two operands have the same type.  This is but the tip of
the iceberg.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com


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