aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/object_overflow5.adb
blob: 4a4f6cfe30eb7b49192632b324707a437ca84ece (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
-- { dg-do compile }

procedure Object_Overflow5 is

  procedure Proc (c : Character) is begin null; end;

  type Index is new Long_Integer range 0 .. Long_Integer'Last;

  type Arr is array(Index range <>) of Character;

  type Rec (Size: Index := 6) is record -- { dg-warning "Storage_Error" }
    A: Arr (0..Size);
  end record;

  Obj : Rec; -- { dg-warning "Storage_Error" }

begin
  Obj.A(1) := 'a';
  Proc (Obj.A(1));
end;