1-- { dg-do compile }
2-- { dg-options "-O2" }
3
4PROCEDURE Array8 IS
5
6  function ID (I : Integer) return Integer is
7  begin
8    return I;
9  end;
10
11  SUBTYPE STB IS INTEGER RANGE ID(-8) .. -5;
12
13  TYPE TB IS ARRAY (STB RANGE <>) OF INTEGER;
14
15  GENERIC
16    B1 : TB;
17  PROCEDURE PROC1;
18
19  PROCEDURE PROC1 IS
20  BEGIN
21    IF B1'FIRST /= -8 THEN
22      raise Program_Error;
23    ELSIF B1'LAST /= ID(-5) THEN
24      raise Program_Error;
25    ELSIF B1 /= (7, 6, 5, 4) THEN
26      raise Program_Error;
27    END IF;
28  END;
29
30  PROCEDURE PROC2 IS NEW PROC1 ((7, 6, ID(5), 4));
31
32BEGIN
33  PROC2;
34END;
35