-- { dg-do compile }
|
-- { dg-do compile }
|
|
|
package Size_Clause3 is
|
package Size_Clause3 is
|
|
|
-- The record inherits the alignment of Integer, which is 4, so
|
-- The record inherits the alignment of Integer, which is 4, so
|
-- the real size is 64 instead of 40.
|
-- the real size is 64 instead of 40.
|
type R1 is record
|
type R1 is record
|
I : Integer;
|
I : Integer;
|
B : aliased Boolean;
|
B : aliased Boolean;
|
end record;
|
end record;
|
|
|
-- That's not OK, the size of a component of type R1 cannot be 40.
|
-- That's not OK, the size of a component of type R1 cannot be 40.
|
type S1 is record
|
type S1 is record
|
rr : R1; -- size must be 40
|
rr : R1; -- size must be 40
|
end record;
|
end record;
|
for S1 use record
|
for S1 use record
|
rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
|
rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
|
end record;
|
end record;
|
|
|
-- The record is explicitly given alignment 1 so its real type is 40.
|
-- The record is explicitly given alignment 1 so its real type is 40.
|
type R2 is record
|
type R2 is record
|
I : Integer;
|
I : Integer;
|
B : aliased Boolean;
|
B : aliased Boolean;
|
end record;
|
end record;
|
for R2'Alignment use 1;
|
for R2'Alignment use 1;
|
|
|
-- That's OK, the size of a component of type R2 can be 40.
|
-- That's OK, the size of a component of type R2 can be 40.
|
type S2 is record
|
type S2 is record
|
rr : R2; -- size must be 40
|
rr : R2; -- size must be 40
|
end record;
|
end record;
|
for S2 use record
|
for S2 use record
|
rr at 0 range 0 .. 39;
|
rr at 0 range 0 .. 39;
|
end record;
|
end record;
|
|
|
-- The record is explicitly given alignment 4 so its real type is 64.
|
-- The record is explicitly given alignment 4 so its real type is 64.
|
type R3 is record
|
type R3 is record
|
I : Integer;
|
I : Integer;
|
B : aliased Boolean;
|
B : aliased Boolean;
|
end record;
|
end record;
|
for R3'Alignment use 4;
|
for R3'Alignment use 4;
|
|
|
-- That's not OK, the size of a component of type R3 cannot be 40.
|
-- That's not OK, the size of a component of type R3 cannot be 40.
|
type S3 is record
|
type S3 is record
|
rr : R3; -- size must be 40
|
rr : R3; -- size must be 40
|
end record;
|
end record;
|
for S3 use record
|
for S3 use record
|
rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
|
rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
|
end record;
|
end record;
|
|
|
end Size_Clause3;
|
end Size_Clause3;
|
|
|