| 1 |
-- { dg-do run } |
| 2 |
-- { dg-options "-O2 -gnatp -fno-omit-frame-pointer" } |
| 3 |
|
| 4 |
procedure Opt76 is |
| 5 |
|
| 6 |
type Integer_Access is access Integer; |
| 7 |
type Registry_Array is array (Natural range <>) of Integer_Access; |
| 8 |
|
| 9 |
procedure Nested (Input, Parser : Integer; A, B : Boolean) is |
| 10 |
|
| 11 |
Index : Registry_Array (1 .. 1024); |
| 12 |
Not_B : constant Boolean := not B; |
| 13 |
|
| 14 |
procedure Inner (Input : Integer) is |
| 15 |
begin |
| 16 |
if Input /= 1 then |
| 17 |
raise Program_Error; |
| 18 |
end if; |
| 19 |
|
| 20 |
if Parser = 128 and then A and then Not_B then |
| 21 |
Inner (Input); |
| 22 |
Index (Index'First) := null; |
| 23 |
end if; |
| 24 |
end; |
| 25 |
|
| 26 |
begin |
| 27 |
Inner (Input); |
| 28 |
end; |
| 29 |
|
| 30 |
Input : Integer := 1 with Volatile; |
| 31 |
Parser : Integer := 2 with Volatile; |
| 32 |
|
| 33 |
begin |
| 34 |
Nested (Input, Parser, False, True); |
| 35 |
Nested (Input, Parser, True, False); |
| 36 |
end; |