From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gnat.dg/specs/size_clause2.ads | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/specs/size_clause2.ads (limited to 'gcc/testsuite/gnat.dg/specs/size_clause2.ads') diff --git a/gcc/testsuite/gnat.dg/specs/size_clause2.ads b/gcc/testsuite/gnat.dg/specs/size_clause2.ads new file mode 100644 index 000000000..957d3920f --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/size_clause2.ads @@ -0,0 +1,48 @@ +-- { dg-do compile } + +package Size_Clause2 is + + -- The alignment of the record is capped to the greatest power of 2 + -- factor of the size, so that the real size is 40 too and the size + -- of a component of type R1 in a packed record can be 40. + type R1 is record + I : Integer; + B : aliased Boolean; + end record; + for R1'Size use 40; + + type S1 is record + rr : R1; -- size must be 40 + end record; + pragma Pack(S1); + + -- The record is explicitly given alignment 1 so its real type is 40 too. + -- The size of a component of type R2 in a packed record is naturally 40. + type R2 is record + I : Integer; + B : aliased Boolean; + end record; + for R2'Size use 40; + for R2'Alignment use 1; + + type S2 is record + rr : R2; -- size must be 40 + end record; + pragma Pack(S2); + + -- The record is explicitly given alignment 4 so its real type is 64. + -- That's not OK, because the size of a component of type R3 in a packed + -- record cannot be 40 so the size clause is violated. + type R3 is record + I : Integer; + B : aliased Boolean; + end record; + for R3'Size use 40; -- { dg-error "size for .R3. too small" } + for R3'Alignment use 4; + + type S3 is record + rr : R3; -- size must be 40 + end record; + pragma Pack(S3); + +end Size_Clause2; -- cgit v1.2.3