2016-11-21 Thomas Preud'homme <thomas.preudhomme@arm.com>
[official-gcc.git] / gcc / testsuite / gnat.dg / sso7.adb
blob114373deecab470366aa5edadbf370dfc0cd629e
1 -- { dg-do run }
3 with System;
5 procedure SSO7 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 R1 : Rec1;
22 end record;
23 for Rec2 use record
24 R1 at 0 range 0 .. 31;
25 end record;
26 for Rec2'Bit_Order use System.High_Order_First;
27 for Rec2'Scalar_Storage_Order use System.High_Order_First;
29 type Rec3 is record
30 Data : Rec1;
31 end record;
32 for Rec3 use record
33 Data at 0 range 1 .. 32;
34 end record;
35 for Rec3'Bit_Order use System.High_Order_First;
36 for Rec3'Scalar_Storage_Order use System.High_Order_First;
38 procedure Copy (Message : in Rec3) is
39 Local : Rec2;
40 begin
41 Local := (R1 => Message.Data);
42 if Local.R1 /= Message.Data then
43 raise Program_Error;
44 end if;
45 end;
47 Message : Rec3;
49 begin
50 Message := (Data => (2, 3));
51 Copy(Message);
52 end;