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