diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gnat.dg/rep_clause1.adb | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.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/rep_clause1.adb')
-rw-r--r-- | gcc/testsuite/gnat.dg/rep_clause1.adb | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/rep_clause1.adb b/gcc/testsuite/gnat.dg/rep_clause1.adb new file mode 100644 index 000000000..b7f5c7dd4 --- /dev/null +++ b/gcc/testsuite/gnat.dg/rep_clause1.adb @@ -0,0 +1,101 @@ +-- { dg-do compile } + +with Ada.Text_IO; use Ada.Text_IO; + +procedure Rep_Clause1 is + + type Int_16 is range 0 .. 65535; + for Int_16'Size use 16; + + ---------------------------------------------- + + type Rec_A is + record + Int_1 : Int_16; + Int_2 : Int_16; + Int_3 : Int_16; + Int_4 : Int_16; + end record; + + + for Rec_A use record + Int_1 at 0 range 0 .. 15; + Int_2 at 2 range 0 .. 15; + Int_3 at 4 range 0 .. 15; + Int_4 at 6 range 0 .. 15; + end record; + + Rec_A_Size : constant := 4 * 16; + + for Rec_A'Size use Rec_A_Size; + + ---------------------------------------------- + + type Rec_B_Version_1 is + record + Rec_1 : Rec_A; + Rec_2 : Rec_A; + Int_1 : Int_16; + end record; + + for Rec_B_Version_1 use record + Rec_1 at 0 range 0 .. 63; + Rec_2 at 8 range 0 .. 63; + Int_1 at 16 range 0 .. 15; + end record; + + Rec_B_Size : constant := 2 * Rec_A_Size + 16; + + for Rec_B_Version_1'Size use Rec_B_Size; + for Rec_B_Version_1'Alignment use 2; + + ---------------------------------------------- + + type Rec_B_Version_2 is + record + Int_1 : Int_16; + Rec_1 : Rec_A; + Rec_2 : Rec_A; + end record; + + for Rec_B_Version_2 use record + Int_1 at 0 range 0 .. 15; + Rec_1 at 2 range 0 .. 63; + Rec_2 at 10 range 0 .. 63; + end record; + + for Rec_B_Version_2'Size use Rec_B_Size; + + ---------------------------------------------- + + Arr_A_Length : constant := 2; + Arr_A_Size : constant := Arr_A_Length * Rec_B_Size; + + type Arr_A_Version_1 is array (1 .. Arr_A_Length) of Rec_B_Version_1; + type Arr_A_Version_2 is array (1 .. Arr_A_Length) of Rec_B_Version_2; + + pragma Pack (Arr_A_Version_1); + pragma Pack (Arr_A_Version_2); + + for Arr_A_Version_1'Size use Arr_A_Size; + for Arr_A_Version_2'Size use Arr_A_Size; + + ---------------------------------------------- + +begin + -- Put_Line ("Arr_A_Size =" & Arr_A_Size'Img); + + if Arr_A_Version_1'Size /= Arr_A_Size then + Ada.Text_IO.Put_Line + ("Version 1 Size mismatch! " & + "Arr_A_Version_1'Size =" & Arr_A_Version_1'Size'Img); + end if; + + if Arr_A_Version_2'Size /= Arr_A_Size then + Ada.Text_IO.Put_Line + ("Version 2 Size mismatch! " & + "Arr_A_Version_2'Size =" & Arr_A_Version_2'Size'Img); + + end if; + +end; |