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

with Interfaces.C; use Interfaces.C;

procedure Object_Overflow3 is

  procedure Proc (x : Boolean) is begin null; end;

  type Arr is array(0 .. ptrdiff_t'Last) of Boolean;

  type Rec is record
    A : Arr;
    B : Arr;
  end record;

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

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