OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c4/] [c43212a.ada] - Blame information for rev 720

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 720 jeremybenn
-- C43212A.ADA
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
-- CHECK THAT CONSTRAINT_ERROR IS RAISED IF ALL SUBAGGREGATES FOR A
26
-- PARTICULAR DIMENSION DO NOT HAVE THE SAME BOUNDS.
27
 
28
-- EG  02/06/1984
29
-- JBG 3/30/84
30
-- JRK 4/18/86   CORRECTED ERROR TO ALLOW CONSTRAINT_ERROR TO BE
31
--               RAISED EARLIER.
32
-- EDS 7/15/98   AVOID OPTIMIZATION.
33
 
34
WITH REPORT;
35
 
36
PROCEDURE C43212A IS
37
 
38
     USE REPORT;
39
 
40
BEGIN
41
 
42
     TEST ("C43212A", "CHECK THAT CONSTRAINT_ERROR IS RAISED IF ALL " &
43
                      "SUBAGGREGATES FOR A PARTICULAR DIMENSION DO "  &
44
                      "NOT HAVE THE SAME BOUNDS");
45
 
46
     DECLARE
47
 
48
          TYPE CHOICE_INDEX IS (H, I);
49
          TYPE CHOICE_CNTR  IS ARRAY(CHOICE_INDEX) OF INTEGER;
50
 
51
          CNTR : CHOICE_CNTR := (CHOICE_INDEX => 0);
52
 
53
          FUNCTION CALC (A : CHOICE_INDEX; B : INTEGER)
54
                                             RETURN INTEGER IS
55
          BEGIN
56
               CNTR(A) := CNTR(A) + 1;
57
               RETURN IDENT_INT(B);
58
          END CALC;
59
 
60
     BEGIN
61
 
62
CASE_1 :  DECLARE
63
 
64
               TYPE T IS ARRAY(INTEGER RANGE <>, INTEGER RANGE <>)
65
                                                   OF INTEGER;
66
 
67
               A1 : T(1 .. 3, 2 .. 5) := (OTHERS => (OTHERS => 0));
68
 
69
          BEGIN
70
 
71
               CNTR := (CHOICE_INDEX => 0);
72
               A1 := (1 => (CALC(H,2) .. CALC(I,5) => -4),
73
                      2 => (CALC(H,3) .. CALC(I,6) => -5),
74
                      3 => (CALC(H,2) .. CALC(I,5) => -3));
75
               FAILED ("CASE 1 : CONSTRAINT_ERROR NOT RAISED" &
76
                       INTEGER'IMAGE(A1(1,5)) );
77
 
78
          EXCEPTION
79
 
80
               WHEN CONSTRAINT_ERROR =>
81
                    IF CNTR(H) < 2 AND CNTR(I) < 2 THEN
82
                         FAILED ("CASE 1 : BOUNDS OF SUBAGGREGATES " &
83
                                 "NOT DETERMINED INDEPENDENTLY");
84
                    END IF;
85
 
86
               WHEN OTHERS =>
87
                    FAILED ("CASE 1 : WRONG EXCEPTION RAISED");
88
 
89
          END CASE_1;
90
 
91
CASE_1A : DECLARE
92
 
93
               TYPE T IS ARRAY(INTEGER RANGE <>, INTEGER RANGE <>)
94
                                                  OF INTEGER;
95
 
96
               A1 : T(1 .. 3, 2 .. 3) := (1 .. 3 => (2 .. 3 => 1));
97
 
98
          BEGIN
99
 
100
               IF (1 .. 2 => (IDENT_INT(3) .. IDENT_INT(4) => 0),
101
                        3 => (1, 2)) = A1 THEN
102
                    BEGIN
103
                         COMMENT(" IF SHOULD GENERATE CONSTRAINT_ERROR " &
104
                                 INTEGER'IMAGE(A1(1,2)) );
105
                    EXCEPTION
106
                         WHEN OTHERS =>
107
                            FAILED ("CASE 1A : CONSTRAINT_ERROR NOT RAISED");
108
                    END;
109
               END IF;
110
                    FAILED ("CASE 1A : CONSTRAINT_ERROR NOT RAISED");
111
 
112
          EXCEPTION
113
 
114
               WHEN CONSTRAINT_ERROR =>
115
                    NULL;
116
 
117
               WHEN OTHERS =>
118
                    FAILED ("CASE 1A : WRONG EXCEPTION RAISED");
119
 
120
          END CASE_1A;
121
 
122
CASE_2 :  DECLARE
123
 
124
               TYPE T IS ARRAY(INTEGER RANGE <>, INTEGER RANGE <>)
125
                                                   OF INTEGER;
126
 
127
               A2 : T(1 .. 3, IDENT_INT(4) .. 2);
128
 
129
          BEGIN
130
 
131
               CNTR := (CHOICE_INDEX => 0);
132
               A2 := (1 => (CALC(H,5) .. CALC(I,3) => -4),
133
                      3 => (CALC(H,4) .. CALC(I,2) => -5),
134
                      2 => (CALC(H,4) .. CALC(I,2) => -3));
135
               FAILED ("CASE 2 : CONSTRAINT_ERROR NOT RAISED " &
136
                       INTEGER'IMAGE(IDENT_INT(A2'FIRST(1))));
137
          EXCEPTION
138
 
139
               WHEN CONSTRAINT_ERROR =>
140
                    IF CNTR(H) < 2 AND CNTR(I) < 2 THEN
141
                         FAILED ("CASE 2 : BOUNDS OF SUBAGGREGATES " &
142
                                 "NOT DETERMINED INDEPENDENTLY");
143
                    END IF;
144
 
145
               WHEN OTHERS =>
146
                    FAILED ("CASE 2 : WRONG EXCEPTION RAISED");
147
 
148
          END CASE_2;
149
 
150
     END;
151
 
152
     RESULT;
153
 
154
END C43212A;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.