2018-03-15 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gnat.dg / pack17.adb
blob2333ba7f910acd22044a4df4f0e66295258c3d72
1 -- { dg-do run }
3 procedure Pack17 is
5 type Bitmap_T is array (Natural range <>) of Boolean;
6 pragma Pack (Bitmap_T);
8 type Uint8 is range 0 .. 2 ** 8 - 1;
9 for Uint8'Size use 8;
11 type Record_With_QImode_Variants (D : Boolean) is record
12 C_Filler : Bitmap_T (1..7);
13 C_Map : Bitmap_T (1..3);
14 case D is
15 when False =>
16 F_Bit : Boolean;
17 F_Filler : Bitmap_T (1..7);
18 when True =>
19 T_Int : Uint8;
20 end case;
21 end record;
22 pragma Pack (Record_With_QImode_Variants);
24 procedure Fill (R : out Record_With_QImode_Variants) is
25 begin
26 R.C_Filler := (True, False, True, False, True, False, True);
27 R.C_Map := (True, False, True);
28 R.T_Int := 17;
29 end;
31 RT : Record_With_QImode_Variants (D => True);
33 begin
34 Fill (RT);
35 if RT.T_Int /= 17 then
36 raise Program_Error;
37 end if;
38 end;