* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gnat.dg / discr40.ads
blobb4ec3ada8b48ac036da4131aa37fb0a4ab9e2217
1 pragma Assertion_Policy(Check);
3 package Discr40 is
5 subtype Element is Integer;
7 type Vector is array (Positive range <>) of Element;
9 type Stack (Max_Length : Natural) is
10 record
11 Length : Natural;
12 Data : Vector (1 .. Max_Length);
13 end record;
15 function Not_Full (S : Stack) return Boolean is
16 (S.Length < S.Max_Length);
18 procedure Push (S: in out Stack; E : Element)
19 with Pre => Not_Full(S), -- Precodition
20 Post => -- Postcondition
21 (S.Length = S'Old.Length + 1) and
22 (S.Data (S.Length) = E) and
23 (for all J in 1 .. S'Old.Length =>
24 S.Data(J) = S'Old.Data(J));
26 end Discr40;