summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/opt49.adb
blob: 42ab953a2e05f0237bdc00359510665012681d42 (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
29
30
31
32
-- { dg-do run }
-- { dg-require-stack-check "" }
-- { dg-options "-O -fstack-check" }

procedure Opt49 is

   function Ident (I : Integer) return Integer;
   pragma No_Inline (Ident);

   function Ident (I : Integer) return Integer is
   begin
     return I;
   end;

   Int_0 : Integer := Ident (0);
   Int_4 : Integer := Ident (4);

   A : array (-4 .. Int_4) of Integer;

begin
   A := (-4 , -3 , -2 , -1 , 100 , 1 , 2 , 3 , 4);
   A (-4 .. Int_0) :=  A (Int_0 .. 4); 
   if A /= (100 ,  1 ,  2 ,  3 ,  4  , 1 , 2 , 3 , 4) then
      raise Program_Error;
   end if;

   A := (-4 , -3 , -2 , -1 , 100 ,  1 ,  2 ,  3 ,  4);
   A (Int_0 .. 4) := A (-4 .. Int_0); 
   if A /= (-4 , -3 , -2 , -1 , -4  , -3 , -2 , -1 , 100) then
      raise Program_Error;
   end if;
end;