OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [gnat.dg/] [specs/] [size_clause2.ads] - Blame information for rev 779

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
-- { dg-do compile }
2
 
3
package Size_Clause2 is
4
 
5
  -- The alignment of the record is capped to the greatest power of 2
6
  -- factor of the size, so that the real size is 40 too and the size
7
  -- of a component of type R1 in a packed record can be 40.
8
  type R1 is record
9
    I : Integer;
10
    B : aliased Boolean;
11
  end record;
12
  for R1'Size use 40;
13
 
14
  type S1 is record
15
    rr : R1; -- size must be 40
16
  end record;
17
  pragma Pack(S1);
18
 
19
  -- The record is explicitly given alignment 1 so its real type is 40 too.
20
  -- The size of a component of type R2 in a packed record is naturally 40.
21
  type R2 is record
22
    I : Integer;
23
    B : aliased Boolean;
24
  end record;
25
  for R2'Size use 40;
26
  for R2'Alignment use 1;
27
 
28
  type S2 is record
29
    rr : R2; -- size must be 40
30
  end record;
31
  pragma Pack(S2);
32
 
33
  -- The record is explicitly given alignment 4 so its real type is 64.
34
  -- That's not OK, because the size of a component of type R3 in a packed
35
  -- record cannot be 40 so the size clause is violated.
36
  type R3 is record
37
    I : Integer;
38
    B : aliased Boolean;
39
  end record;
40
  for R3'Size use 40;  -- { dg-error "size for .R3. too small" }
41
  for R3'Alignment use 4;
42
 
43
  type S3 is record
44
    rr : R3; -- size must be 40
45
  end record;
46
  pragma Pack(S3);
47
 
48
end Size_Clause2;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.