Debian Codegraph @

gcc/testsuite/gnat.dg/pack19.adb

raw
1 -- { dg-do run }
2
3 procedure Pack19 is
4
5 subtype Always_False is Boolean range False .. False;
6
7 type Rec1 is record
8 B1 : Boolean;
9 B2 : Boolean;
10 B3 : Boolean;
11 B4 : Boolean;
12 B5 : Boolean;
13 B6 : Boolean;
14 B7 : Always_False;
15 B8 : Boolean;
16 end record;
17 pragma Pack (Rec1);
18
19 subtype Always_True is Boolean range True .. True;
20
21 type Rec2 is record
22 B1 : Boolean;
23 B2 : Boolean;
24 B3 : Boolean;
25 B4 : Boolean;
26 B5 : Boolean;
27 B6 : Boolean;
28 B7 : Always_True;
29 B8 : Boolean;
30 end record;
31 pragma Pack (Rec2);
32
33 R1 : Rec1 := (True, True, True, True, True, True, False, False);
34 R2 : Rec2 := (False, False, False, False, False, False, True, True);
35
36 begin
37 R1.B8 := True;
38 if R1.B7 /= False then
39 raise Program_Error;
40 end if;
41
42 R1.B7 := False;
43 if R1.B7 /= False then
44 raise Program_Error;
45 end if;
46
47 R2.B8 := False;
48 if R2.B7 /= True then
49 raise Program_Error;
50 end if;
51
52 R2.B7 := True;
53 if R2.B7 /= True then
54 raise Program_Error;
55 end if;
56 end;