Preserving locations for variable-uses and constants (PR c++/43486)
[official-gcc.git] / gcc / testsuite / gnat.dg / bit_packed_array3.adb
blob0b121efdc5f939e4ae0aeb23d268f91245975ce0
1 -- { dg-do run }
2 -- { dg-options "-O2 -gnatp" }
4 procedure Bit_Packed_Array3 is
6 type Bitmap_T is array (1 .. 10) of Boolean;
7 pragma Pack (Bitmap_T);
9 type Maps_T is record
10 M1 : Bitmap_T;
11 end record;
12 pragma Pack (Maps_T);
13 for Maps_T'Size use 10;
14 pragma Suppress_Initialization (Maps_T);
16 Tmap : constant Bitmap_T := (others => True);
17 Fmap : constant Bitmap_T := (others => False);
18 Amap : constant Bitmap_T :=
19 (1 => False, 2 => True, 3 => False, 4 => True, 5 => False,
20 6 => True, 7 => False, 8 => True, 9 => False, 10 => True);
22 function Some_Maps return Maps_T is
23 Value : Maps_T := (M1 => Amap);
24 begin
25 return Value;
26 end;
27 pragma Inline (Some_Maps);
29 Maps : Maps_T;
30 begin
31 Maps := Some_Maps;
33 for I in Maps.M1'Range loop
34 if (I mod 2 = 0 and then not Maps.M1 (I))
35 or else (I mod 2 /= 0 and then Maps.M1 (I))
36 then
37 raise Program_Error;
38 end if;
39 end loop;
40 end;