aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt35.adb
blob: b0defe07ca6ab0b8d34f2e80c8abc7d57a70534f (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
-- { dg-do run }
-- { dg-options "-O" }

with Opt35_Pkg; use Opt35_Pkg;

procedure Opt35 is
  I : Integer := -1;
  N : Natural := 0;
begin
  begin
    I := F(0);
  exception
    when E => N := N + 1;
  end;

  begin
    I := I + F(0);
  exception
    when E => N := N + 1;
  end;

  if N /= 2 or I = 0 then
    raise Program_Error;
  end if;
end;