OSDN Git Service

4172fc013ce993c81c823fde7688ac69584e2612
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gnat.dg / frame_overflow.adb
1 -- { dg-do compile }
2
3 procedure frame_overflow is
4
5    type Bitpos_Range_T is new Positive;
6    type Bitmap_Array_T is array (Bitpos_Range_T) of Boolean;
7
8    type Bitmap_T is record
9       Bits : Bitmap_Array_T := (others => False);
10    end record;
11    
12    function -- { dg-error "too large" "" }
13      Set_In (Bitmap : Bitmap_T; Bitpos : Bitpos_Range_T)  return Bitmap_T
14    is
15       Result: Bitmap_T := Bitmap;
16    begin
17       Result.Bits (Bitpos) := True;
18       return Result;
19    end;
20
21    function -- { dg-error "too large" "" }
22      Negate (Bitmap : Bitmap_T) return Bitmap_T is
23       Result: Bitmap_T;
24    begin
25       for E in Bitpos_Range_T loop
26         Result.Bits (E) := not Bitmap.Bits (E);
27       end loop;
28       return Result;
29   end;
30
31 begin
32    null;
33 end;