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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cb/] [cb1010a.ada] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CB1010A.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 STORAGE_ERROR IS RAISED WHEN STORAGE ALLOCATED TO A TASK
26
-- IS EXCEEDED.
27
 
28
-- PNH 8/26/85
29
-- JRK 8/30/85
30
 
31
WITH REPORT; USE REPORT;
32
 
33
PROCEDURE CB1010A IS
34
 
35
     N : INTEGER := IDENT_INT (1);
36
     M : INTEGER := IDENT_INT (0);
37
 
38
     PROCEDURE OVERFLOW_STACK IS
39
          A : ARRAY (1 .. 1000) OF INTEGER;
40
     BEGIN
41
          N := N + M;
42
          A (N) := M;
43
          IF N > M THEN  -- ALWAYS TRUE.
44
               OVERFLOW_STACK;
45
          END IF;
46
          M := A (N);    -- TO PREVENT TAIL RECURSION OPTIMIZATION.
47
     END OVERFLOW_STACK;
48
 
49
BEGIN
50
     TEST ("CB1010A", "CHECK THAT STORAGE_ERROR IS RAISED WHEN " &
51
                      "STORAGE ALLOCATED TO A TASK IS EXCEEDED");
52
 
53
     --------------------------------------------------
54
 
55
     COMMENT ("CHECK TASKS THAT DO NOT HANDLE STORAGE_ERROR " &
56
              "PRIOR TO RENDEZVOUS");
57
 
58
     DECLARE
59
 
60
          TASK T1 IS
61
               ENTRY E1;
62
          END T1;
63
 
64
          TASK BODY T1 IS
65
          BEGIN
66
               OVERFLOW_STACK;
67
               FAILED ("TASK T1 NOT TERMINATED BY STACK OVERFLOW");
68
          END T1;
69
 
70
     BEGIN
71
 
72
          T1.E1;
73
          FAILED ("NO EXCEPTION RAISED BY ENTRY CALL T1.E1");
74
 
75
     EXCEPTION
76
          WHEN TASKING_ERROR =>
77
               IF N /= 1 OR M /= 0 THEN
78
                    FAILED ("VALUES OF VARIABLES N OR M ALTERED - 1");
79
               END IF;
80
          WHEN OTHERS =>
81
               FAILED ("WRONG EXCEPTION RAISED BY CALL OF ENTRY E1 " &
82
                       "OF TERMINATED TASK T1");
83
     END;
84
 
85
     --------------------------------------------------
86
 
87
     COMMENT ("CHECK TASKS THAT DO HANDLE STORAGE_ERROR PRIOR TO " &
88
              "RENDEZVOUS");
89
 
90
     N := IDENT_INT (1);
91
     M := IDENT_INT (0);
92
 
93
     DECLARE
94
 
95
          TASK T2 IS
96
               ENTRY E2;
97
          END T2;
98
 
99
          TASK BODY T2 IS
100
          BEGIN
101
               OVERFLOW_STACK;
102
               FAILED ("EXCEPTION NOT RAISED BY STACK OVERFLOW IN " &
103
                       "TASK T2");
104
          EXCEPTION
105
               WHEN STORAGE_ERROR =>
106
                    ACCEPT E2;
107
               WHEN OTHERS =>
108
                    FAILED ("WRONG EXCEPTION RAISED IN TASK T2 BY " &
109
                            "STACK OVERFLOW");
110
          END T2;
111
 
112
     BEGIN
113
 
114
          T2.E2;
115
          IF N /= 1 OR M /= 0 THEN
116
               FAILED ("VALUES OF VARIABLES N OR M ALTERED - 2");
117
          END IF;
118
 
119
     EXCEPTION
120
          WHEN OTHERS =>
121
               FAILED ("EXCEPTION RAISED BY ENTRY CALL T2.E2");
122
               ABORT T2;
123
     END;
124
 
125
     --------------------------------------------------
126
 
127
     COMMENT ("CHECK TASKS THAT DO NOT HANDLE STORAGE_ERROR " &
128
              "DURING RENDEZVOUS");
129
 
130
     N := IDENT_INT (1);
131
     M := IDENT_INT (0);
132
 
133
     DECLARE
134
 
135
          TASK T3 IS
136
               ENTRY E3A;
137
               ENTRY E3B;
138
          END T3;
139
 
140
          TASK BODY T3 IS
141
          BEGIN
142
               ACCEPT E3A DO
143
                    OVERFLOW_STACK;
144
                    FAILED ("EXCEPTION NOT RAISED IN ACCEPT E3A BY " &
145
                            "STACK OVERFLOW");
146
               END E3A;
147
               FAILED ("EXCEPTION NOT PROPOGATED CORRECTLY IN TASK T3");
148
          EXCEPTION
149
               WHEN STORAGE_ERROR =>
150
                    ACCEPT E3B;
151
               WHEN OTHERS =>
152
                    FAILED ("WRONG EXCEPTION RAISED IN TASK T3 BY " &
153
                            "STACK OVERFLOW");
154
          END T3;
155
 
156
     BEGIN
157
 
158
          T3.E3A;
159
          FAILED ("NO EXCEPTION RAISED BY ENTRY CALL T3.E3A");
160
 
161
     EXCEPTION
162
          WHEN STORAGE_ERROR =>
163
               T3.E3B;
164
               IF N /= 1 OR M /= 0 THEN
165
                    FAILED ("VALUES OF VARIABLES N OR M ALTERED - 3");
166
               END IF;
167
          WHEN TASKING_ERROR =>
168
               FAILED ("TASKING_ERROR RAISED BY ENTRY CALL T3.E3A " &
169
                       "INSTEAD OF STORAGE_ERROR");
170
               ABORT T3;
171
          WHEN OTHERS =>
172
               FAILED ("WRONG EXCEPTION RAISED BY ENTRY CALL T3.E3A");
173
               ABORT T3;
174
     END;
175
 
176
     --------------------------------------------------
177
 
178
     RESULT;
179
END CB1010A;

powered by: WebSVN 2.1.0

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