summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs/size_clause3.ads
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gnat.dg/specs/size_clause3.ads
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/gnat.dg/specs/size_clause3.ads')
-rw-r--r--gcc/testsuite/gnat.dg/specs/size_clause3.ads50
1 files changed, 50 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/specs/size_clause3.ads b/gcc/testsuite/gnat.dg/specs/size_clause3.ads
new file mode 100644
index 000000000..6a89114e4
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/specs/size_clause3.ads
@@ -0,0 +1,50 @@
+-- { dg-do compile }
+
+package Size_Clause3 is
+
+ -- The record inherits the alignment of Integer, which is 4, so
+ -- the real size is 64 instead of 40.
+ type R1 is record
+ I : Integer;
+ B : aliased Boolean;
+ end record;
+
+ -- That's not OK, the size of a component of type R1 cannot be 40.
+ type S1 is record
+ rr : R1; -- size must be 40
+ end record;
+ for S1 use record
+ rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
+ end record;
+
+ -- The record is explicitly given alignment 1 so its real type is 40.
+ type R2 is record
+ I : Integer;
+ B : aliased Boolean;
+ end record;
+ for R2'Alignment use 1;
+
+ -- That's OK, the size of a component of type R2 can be 40.
+ type S2 is record
+ rr : R2; -- size must be 40
+ end record;
+ for S2 use record
+ rr at 0 range 0 .. 39;
+ end record;
+
+ -- The record is explicitly given alignment 4 so its real type is 64.
+ type R3 is record
+ I : Integer;
+ B : aliased Boolean;
+ end record;
+ for R3'Alignment use 4;
+
+ -- That's not OK, the size of a component of type R3 cannot be 40.
+ type S3 is record
+ rr : R3; -- size must be 40
+ end record;
+ for S3 use record
+ rr at 0 range 0 .. 39; -- { dg-error "size of .rr. with aliased or tagged component" }
+ end record;
+
+end Size_Clause3;