aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gnat.dg/loop_optimization13.adb
blob: 7000172e90b2b962a55ef4cf25d63b75af15fc1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
-- { dg-do compile }
-- { dg-options "-O" }

with Loop_Optimization13_Pkg; use Loop_Optimization13_Pkg;

package body Loop_Optimization13 is

   function F (A : Rec) return Rec is
      N : constant Integer := A.V'Length / L;
      Res : Rec
        := (True, new Complex_Vector' (0 .. A.V'Length / L - 1 => (0.0, 0.0)));
   begin
      for I in 0 .. L - 1 loop
         for J in 0 .. N - 1 loop
            Res.V (J) := Res.V (J) + A.V (I * N + J);
         end loop;
      end loop;
      return Res;
   end;

end Loop_Optimization13;