1-- { dg-do run }
2-- { dg-require-stack-check "" }
3-- { dg-options "-O -fstack-check" }
4
5procedure Opt49 is
6
7   function Ident (I : Integer) return Integer;
8   pragma No_Inline (Ident);
9
10   function Ident (I : Integer) return Integer is
11   begin
12     return I;
13   end;
14
15   Int_0 : Integer := Ident (0);
16   Int_4 : Integer := Ident (4);
17
18   A : array (-4 .. Int_4) of Integer;
19
20begin
21   A := (-4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4);
22   A (-4 .. Int_0) :=  A (Int_0 .. 4);
23   if A /= (100 ,  1 ,  2 ,  3 ,  4  , 1 , 2 , 3 , 4) then
24      raise Program_Error;
25   end if;
26
27   A := (-4 , -3 , -2 , -1 , 100 ,  1 ,  2 ,  3 ,  4);
28   A (Int_0 .. 4) := A (-4 .. Int_0);
29   if A /= (-4 , -3 , -2 , -1 , -4  , -3 , -2 , -1 , 100) then
30      raise Program_Error;
31   end if;
32end;
33