diff mbox

[Ada] Passing Stream_Element_Offset/Storage_Offset in heterogeneous DSA apps

Message ID 20110831094259.GA25102@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Aug. 31, 2011, 9:42 a.m. UTC
This change ensures that partitions in a DSA application always use a
64 bit representation when exchanging data of type Stream_Element_Offset or
Storage_Offset, to avoid interoperability issues between 32- and 64-bit hosts.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-08-31  Thomas Quinot  <quinot@adacore.com>

	* rtsfind.ads, exp_dist.adb (Find_Numeric_Representation): Predefined
	types Stream_Element_Offset and Storage_Offset have a different native
	type depending on whether the platform is 32 or 64 bits. When
	exchanging them, always convert to 64 bits.
diff mbox

Patch

Index: rtsfind.ads
===================================================================
--- rtsfind.ads	(revision 178371)
+++ rtsfind.ads	(working copy)
@@ -555,6 +555,7 @@ 
 
      RE_Root_Stream_Type,                -- Ada.Streams
      RE_Stream_Element,                  -- Ada.Streams
+     RE_Stream_Element_Offset,           -- Ada.Streams
 
      RE_Stream_Access,                   -- Ada.Streams.Stream_IO
 
@@ -1748,6 +1749,7 @@ 
 
      RE_Root_Stream_Type                 => Ada_Streams,
      RE_Stream_Element                   => Ada_Streams,
+     RE_Stream_Element_Offset            => Ada_Streams,
 
      RE_Stream_Access                    => Ada_Streams_Stream_IO,
 
Index: exp_dist.adb
===================================================================
--- exp_dist.adb	(revision 178358)
+++ exp_dist.adb	(working copy)
@@ -10842,6 +10842,15 @@ 
             P_Size : constant Uint      := Esize (FST);
 
          begin
+            --  Special case: for Stream_Element_Offset and Storage_Offset,
+            --  always force transmission as a 64-bit value.
+
+            if Is_RTE (FST, RE_Stream_Element_Offset)
+                 or else Is_RTE (FST, RE_Storage_Offset)
+            then
+               return RTE (RE_Unsigned_64);
+            end if;
+
             if Is_Unsigned_Type (Typ) then
                if P_Size <= 8 then
                   return RTE (RE_Unsigned_8);