comparison gcc/testsuite/ada/acats/tests/cd/cd33002.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 -- CD33002.A
2 --
3 -- Grant of Unlimited Rights
4 --
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
14 -- to do so.
15 --
16 -- DISCLAIMER
17 --
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
24 --*
25 --
26 -- OBJECTIVE:
27 -- Check that Component_Sizes that are multiples of the word
28 -- size are supported.
29 --
30 -- Check that for such Component_Sizes arrays contain no gaps between
31 -- components.
32 --
33 -- TEST DESCRIPTION:
34 -- This test defines three array types and specifies their layouts
35 -- using representation specifications for the 'Component_Size and
36 -- pragma Packs for each. It then checks that the implied assumptions
37 -- about the resulting layout actually can be made.
38 --
39 -- APPLICABILITY CRITERIA:
40 -- All implementations must attempt to compile this test.
41 --
42 -- For implementations validating against Systems Programming Annex (C):
43 -- this test must execute and report PASSED.
44 --
45 -- For implementations not validating against Annex C:
46 -- this test may report compile time errors at one or more points
47 -- indicated by "-- ANX-C RQMT", in which case it may be graded as inapplicable.
48 -- Otherwise, the test must execute and report PASSED.
49 --
50 --
51 -- CHANGE HISTORY:
52 -- 22 JUL 95 SAIC Initial version
53 -- 07 MAY 96 SAIC Revised for 2.1
54 -- 24 AUG 96 SAIC Additional 2.1 revisions
55 -- 16 FEB 98 EDS Modify documentation.
56 --!
57
58 ----------------------------------------------------------------- CD33002_0
59
60 with System;
61 package CD33002_0 is
62
63 S_Units_per_Word : constant := System.Word_Size/System.Storage_Unit;
64
65 type Nibble is mod 2**4;
66
67 type Byte is mod 2**8;
68
69 type Word_Stuff is array(Natural range <>) of Byte;
70 for Word_Stuff'Component_Size
71 use System.Word_Size; -- ANX-C RQMT.
72 pragma Pack(Word_Stuff); -- ANX-C RQMT.
73
74 type Double_Stuff is array(Natural range <>) of Byte;
75 for Double_Stuff'Component_Size
76 use System.Word_Size * 2; -- multiple -- ANX-C RQMT.
77
78 type Address_Calculator is record
79 Item_1 : Nibble;
80 Item_2 : Nibble;
81 end record;
82
83 for Address_Calculator use record
84 Item_1 at 0 range 0..3;
85 Item_2 at 1 range 0..3;
86 end record;
87
88 -- by definition (13.5.2(2)) abs(Item_2'Address - Item_1'Address) = 1
89 -- it therefore follows that:
90 -- Address_Calculator'Size = 2 * Addressable_Unit'Size
91
92 end CD33002_0;
93
94 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
95
96 -- there is no package body CD33002_0
97
98 ------------------------------------------------------------------- CD33002
99
100 with Report;
101 with TCTouch;
102 with System.Storage_Elements;
103 with CD33002_0;
104 procedure CD33002 is
105
106 use type System.Storage_Elements.Storage_Offset;
107
108 A_Word : CD33002_0.Word_Stuff(0..15);
109
110 A_Double : CD33002_0.Double_Stuff(0..15);
111
112 procedure Unexpected( Message : String; Wanted, Got: Integer ) is
113 begin
114 Report.Failed ( Message & " Wanted:"
115 & Integer'Image(Wanted) & " Got:" & Integer'Image(Got) );
116 end Unexpected;
117
118 begin -- Main test procedure.
119
120 Report.Test ("CD33002", "Check that Component_Sizes that are multiples "
121 & "of the word size are supported. Check that for "
122 & "such Component_Sizes arrays contain no gaps "
123 & "between components" );
124
125 if A_Word'Size /= CD33002_0.Word_Stuff'Component_Size * 16 then
126 Unexpected("Word Size",
127 CD33002_0.Word_Stuff'Component_Size * 16,
128 A_Word'Size );
129 end if;
130
131 if A_Double'Size /= CD33002_0.Double_Stuff'Component_Size * 16 then
132 Unexpected("Double word Size",
133 CD33002_0.Double_Stuff'Component_Size * 16,
134 A_Double'Size );
135 end if;
136
137
138 Report.Result;
139
140 end CD33002;