PR tree-optimization/86415 - strlen() not folded for substrings within constant arrays
[official-gcc.git] / gcc / testsuite / gnat.dg / pack19.adb
blob601039ac0ff7ab8ffc48179f21d9af22caad2641
1 -- { dg-do run }
3 procedure Pack19 is
5 subtype Always_False is Boolean range False .. False;
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);
19 subtype Always_True is Boolean range True .. True;
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);
33 R1 : Rec1 := (True, True, True, True, True, True, False, False);
34 R2 : Rec2 := (False, False, False, False, False, False, True, True);
36 begin
37 R1.B8 := True;
38 if R1.B7 /= False then
39 raise Program_Error;
40 end if;
42 R1.B7 := False;
43 if R1.B7 /= False then
44 raise Program_Error;
45 end if;
47 R2.B8 := False;
48 if R2.B7 /= True then
49 raise Program_Error;
50 end if;
52 R2.B7 := True;
53 if R2.B7 /= True then
54 raise Program_Error;
55 end if;
56 end;