view gcc/testsuite/gnat.dg/opt49.adb @ 138:fc828634a951

merge
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 08 Nov 2018 14:17:14 +0900
parents 04ced10e8804
children
line wrap: on
line source

-- { 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;