1-- { dg-do compile } 2-- { dg-options "-O2 -fdump-tree-cunrolli-details" } 3 4package body Unroll2 is 5 6 function "+" (X, Y : Sarray) return Sarray is 7 R : Sarray; 8 begin 9 for I in Sarray'Range loop 10 pragma Loop_Optimize (Unroll); 11 R(I) := X(I) + Y(I); 12 end loop; 13 return R; 14 end; 15 16 procedure Add (X, Y : Sarray; R : out Sarray) is 17 begin 18 for I in Sarray'Range loop 19 pragma Loop_Optimize (Unroll); 20 R(I) := X(I) + Y(I); 21 end loop; 22 end; 23 24end Unroll2; 25 26-- { dg-final { scan-tree-dump-times "loop with 3 iterations completely unrolled" 2 "cunrolli" } } 27