summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt6.adb
blob: 44dc047b538f2d15c6e64b4a16bb515433930139 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- PR rtl-optimization/45394

-- { dg-do compile }
-- { dg-options "-O2 -g" }

package body Opt6 is

   function Current_Parameter (Iter : Command_Line_Iterator) return String is
   begin
      if Iter.Params = null
        or else Iter.Current > Iter.Params'Last
        or else Iter.Params (Iter.Current) = null
      then
         return "";

      else
         declare
            P : constant String := Iter.Params (Iter.Current).all;

         begin
            --  Skip separator

            return P (P'First + 1 .. P'Last);
         end;
      end if;
   end Current_Parameter;

end Opt6;