Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gnat.dg / loop_optimization19.adb
blob434a7b8d3f9f926a51d402e1fc4ad660e8d9efc6
1 -- { dg-do compile }
2 -- { dg-options "-O -fdump-tree-optimized" }
4 procedure Loop_Optimization19 is
6 type Array_T is array (Positive range <>) of Integer;
7 type Obj_T (Length : Natural) is
8 record
9 Elements : Array_T (1 .. Length);
10 end record;
12 type T is access Obj_T;
14 function Equal (S1, S2 : T) return Boolean;
15 pragma No_Inline (Equal);
17 function Equal (S1, S2 : T) return Boolean is
18 begin
19 if S1.Length = S2.Length then
20 for I in 1 .. S1.Length loop
21 if S1.Elements (I) /= S2.Elements (I) then
22 return False;
23 end if;
24 end loop;
25 return True;
26 else
27 return False;
28 end if;
29 end Equal;
31 A : T := new Obj_T (Length => 10);
32 B : T := new Obj_T (Length => 20);
33 C : T := new Obj_T (Length => 30);
35 begin
36 if Equal (A, B) then
37 raise Program_Error;
38 else
39 if Equal (B, C) then
40 raise Program_Error;
41 end if;
42 end if;
43 end;
45 -- { dg-final { scan-tree-dump-not "Index_Check" "optimized" } }