Preserving locations for variable-uses and constants (PR c++/43486)
[official-gcc.git] / gcc / testsuite / gnat.dg / loop_optimization8.adb
blob6be28f11347effd342b65e102c3b896345f74118
1 -- { dg-do run }
2 -- { dg-options "-O -gnatn" }
4 with Loop_Optimization8_Pkg1;
6 procedure Loop_Optimization8 is
8 Data : Loop_Optimization8_Pkg1.T;
10 procedure Check_1 (N : in Natural) is
11 begin
12 if N /= 0 then
13 for I in 1 .. Data.Last loop
14 declare
15 F : constant Natural := Data.Elements (I);
16 begin
17 if F = N then
18 raise Program_Error;
19 end if;
20 end;
21 end loop;
22 end if;
23 end;
25 procedure Check is new Loop_Optimization8_Pkg1.Iter (Check_1);
27 begin
28 Data := Loop_Optimization8_Pkg1.Empty;
29 Check;
30 end;