aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt34.adb
blob: 546768a1fe8044490c130155f9a8f5939bc0084c (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
-- { dg-do compile }
-- { dg-options "-O -fdump-tree-esra" }

with Opt34_Pkg; use Opt34_Pkg;

procedure Opt34 is

   function Local_Fun (Arg : T_Private) return T_Private is
      Result : T_Private;
   begin

      case Get_Integer (Arg) is
         when 1 =>
            Result := Get_Private (100);
         when 2 =>
            Result := T_Private_Zero;
         when others =>
            null;
      end case;

      return Result;
   end Local_Fun;

begin
   Assert (Get_Integer (Local_Fun (Get_Private (1))) = 100);
end;

-- { dg-final { scan-tree-dump "Created a replacement for result" "esra" } }