summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/scalar_mode_agg_compare_loop.adb
blob: 9bafb4d29bbfe6e702663ab915c6046bc3cbc033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
-- { dg-do compile }
-- { dg-options "-O2 -gnatp" }

function Scalar_Mode_Agg_Compare_Loop return Boolean is
   S : constant String (1 .. 4) := "ABCD";
   F : constant Natural := S'First;
   L : constant Natural := S'Last;
begin
   for J in F .. L - 1 loop
      if S (F .. F) = "X" or (J <= L - 2 and S (J .. J + 1) = "YY") then
         return True;
      end if;
   end loop;

   return False;
end;