summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs/addr1.ads
blob: ed048f68ef3b59a5e71cf0d704c40dc3b10b9b3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- { dg-do compile }

with Interfaces; use Interfaces;

package Addr1 is

  type Arr is array (Integer range <>) of Unsigned_16;

  type Rec1 is record
    I1, I2: Integer;
  end record;

  type Rec2 is record
    I1, I2: Integer;
  end record;
  for Rec2'Size use 64;

  A: Arr (1 .. 4);

  Obj1: Rec1;
  for Obj1'Address use A'Address; -- { dg-bogus "alignment" }

  Obj2: Rec2;
  for Obj2'Address use A'Address; -- { dg-bogus "alignment" }

  Obj3: Rec1;
  for Obj3'Address use A(1)'Address; -- { dg-bogus "alignment" }

  Obj4: Rec1;
  for Obj4'Address use A(2)'Address; -- { dg-warning "(alignment|erroneous)" }

  Obj5: Rec1;
  for Obj5'Address use A(3)'Address; -- { dg-bogus "alignment" }

end Addr1;