[Bug ada/63725] Scalar_Storage_Order and nested string subtypes

2014-11-06 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63725

Eric Botcazou ebotcazou at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-11-06
 CC||ebotcazou at gcc dot gnu.org
Version|4.9.1   |5.0
Summary|Scalar_Storage_Order is |Scalar_Storage_Order and
   |required for nested string  |nested string subtypes
   |types, but cannot be added  |
   |to those types  |
 Ever confirmed|0   |1
   Severity|normal  |enhancement

--- Comment #1 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
I agree this is annoying, but the workaround is trivial (use a derived type
instead of a subtype) so I'm not sure we want to do something here.


[Bug ada/63725] Scalar_Storage_Order and nested string subtypes

2014-11-06 Thread daniel.merrill at psware dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63725

--- Comment #2 from Dan Merrill daniel.merrill at psware dot com ---
Is this what you are proposing?

   type string_type is new string (1..15);
   for string_type'Scalar_Storage_Order use System.High_Order_First;

   type string_array is array (1..2) of string_type;
   for string_array'Scalar_Storage_Order use System.High_Order_First;

   type BigEndianInt32Array is array (1..10) of int32;


   type bigEndianType is record
  ThirtyTwoBits : int32;
  SixteenBits   : int16;
  TestStrings   : string_array;
   end record;

   for bigEndianType use record
  ThirtyTwoBits at 0 range 0  .. 31;
  SixteenBits   at 0 range 32 .. 47;
  TestStrings   at 0 range 48 .. 287;
   end record;

   for bigEndianType'Bit_Order use System.High_Order_First;
   for bigEndianType'Scalar_Storage_Order use System.High_Order_First;

?

That seems to work, but in a non trivial case doesn't that make string_type non
inter operable with other string types? In reality I don't care what the scalar
storage order of the string is because they are just bytes and should work the
same across both platforms. It seems like string_type shouldn't even need a
scalar storage order applied to it.


[Bug ada/63725] Scalar_Storage_Order and nested string subtypes

2014-11-06 Thread ebotcazou at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63725

--- Comment #3 from Eric Botcazou ebotcazou at gcc dot gnu.org ---
 That seems to work, but in a non trivial case doesn't that make string_type
 non inter operable with other string types?

Interoperability should be preserved modulo minor adjustments.