summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/alignment2.adb
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/alignment2.adb
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/alignment2.adb')
-rw-r--r--gcc/testsuite/gnat.dg/alignment2.adb47
1 files changed, 47 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/alignment2.adb b/gcc/testsuite/gnat.dg/alignment2.adb
new file mode 100644
index 000000000..9f1be3c59
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/alignment2.adb
@@ -0,0 +1,47 @@
+-- { dg-do run }
+
+procedure alignment2 is
+
+ pragma COMPONENT_ALIGNMENT(STORAGE_UNIT);
+
+ MAX_LIST_SIZE : constant INTEGER := 128*16;
+
+ LEVEL2_SIZE : constant INTEGER := 128;
+
+ LEVEL1_SIZE : constant INTEGER
+ := (MAX_LIST_SIZE - 1) / LEVEL2_SIZE + 1;
+
+ type LEVEL2_ARRAY_TYPE is
+ array (1..LEVEL2_SIZE) of Integer;
+
+ type LEVEL2_TYPE is
+ record
+ NUM : INTEGER := 0;
+ DATA : LEVEL2_ARRAY_TYPE := ( others => 0 );
+ end record;
+
+ type LEVEL2_PTR_TYPE is access all LEVEL2_TYPE;
+
+ type LEVEL1_ARRAY_TYPE is
+ array( 1..LEVEL1_SIZE ) of LEVEL2_PTR_TYPE;
+
+ type LEVEL1_TYPE is
+ record
+ LAST_LINE : INTEGER := 0;
+ LEVEL2_PTR : LEVEL1_ARRAY_TYPE;
+ end record;
+
+ L1 : LEVEL1_TYPE;
+ L2 : aliased LEVEL2_TYPE;
+
+ procedure q (LA : in out LEVEL1_ARRAY_TYPE) is
+ begin
+ LA (1) := L2'Access;
+ end;
+
+begin
+ q (L1.LEVEL2_PTR);
+ if L1.LEVEL2_PTR (1) /= L2'Access then
+ raise Program_Error;
+ end if;
+end;