PR ipa/83051
[official-gcc.git] / gcc / testsuite / gnat.dg / sso6.adb
blob6d351a43ffd63b15ba8e35c167bd5bcaf5bd8ef8
1 -- { dg-do run }
3 with System;
5 procedure SSO6 is
7 type Short_Int is mod 2**16;
9 type Rec1 is record
10 F1 : Short_Int;
11 F2 : Short_Int;
12 end record;
13 for Rec1 use record
14 F1 at 0 range 0 .. 15;
15 F2 at 0 range 16 .. 31;
16 end record;
17 for Rec1'Bit_Order use System.High_Order_First;
18 for Rec1'Scalar_Storage_Order use System.High_Order_First;
20 type Rec2 is record
21 I1 : Integer;
22 R1 : Rec1;
23 end record;
24 for Rec2 use record
25 I1 at 0 range 0 .. 31;
26 R1 at 4 range 0 .. 31;
27 end record;
28 for Rec2'Bit_Order use System.High_Order_First;
29 for Rec2'Scalar_Storage_Order use System.High_Order_First;
31 type Rec3 is record
32 Data : Rec1;
33 end record;
34 for Rec3 use record
35 Data at 0 range 1 .. 32;
36 end record;
37 for Rec3'Bit_Order use System.High_Order_First;
38 for Rec3'Scalar_Storage_Order use System.High_Order_First;
40 procedure Copy (Message : in Rec3) is
41 Local : Rec2;
42 begin
43 Local := (I1 => 1, R1 => Message.Data);
44 if Local.R1 /= Message.Data then
45 raise Program_Error;
46 end if;
47 end;
49 Message : Rec3;
51 begin
52 Message := (Data => (2, 3));
53 Copy(Message);
54 end;