> currently sizetype precision (cf store-layout.c:initialize_sizetypes) is
> the same as size_t. This is an issue on VMS, where size_t is 'unsigned
> int', but we'd like to have a 64 bit sizetype for Ada.  My understanding is
> that ISO-C doesn't require size_t precision to match the one of void *.

In fact this is very recent: up to (and including) GCC 4.6, each language could 
set its own sizetype (by means of set_sizetype).

> I initially thought about using Pmode precision for sizetype precision, but
> there are a few machines (m32c, sh, h8300) where the precisions aren't the
> same.  I don't know wether this is on purpose or unintentional.

That's what we used to do in Ada, see gnat_init:

  /* In Ada, we use the unsigned type corresponding to the width of Pmode as
     SIZETYPE.  In most cases when ptr_mode and Pmode differ, C will use the
     width of ptr_mode for SIZETYPE, but we get better code using the width
     of Pmode.  Note that, although we manipulate negative offsets for some
     internal constructs and rely on compile time overflow detection in size
     computations, using unsigned types for SIZETYPEs is fine since they are
     treated specially by the middle-end, in particular sign-extended.  */
  size_type_node = gnat_type_for_mode (Pmode, 1);
  set_sizetype (size_type_node);
  TYPE_NAME (sizetype) = get_identifier ("size_type");

Eric Botcazou

Reply via email to