summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/alignment9.adb
blob: ae7a7f67e9e8bb44f2430ce992d3729406b8813e (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
-- { dg-do run }
-- { dg-options "-gnatws" }

procedure Alignment9 is

  type Kind is (Small, Large);
  for Kind'Size use 8;

  type Header is
    record
      K : Kind;
      I : Integer;
    end record;

  for Header use
    record
      K at 4 range 0..7;
      I at 0 range 0..31;
    end record;

  for Header'Size use 5*8;
  for Header'Alignment use 1;

  H : Header;

begin
  if H'Size /= 40 then
    raise Program_Error;
  end if;
end;