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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cb/] [cb4009a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- CB4009A.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 A PROGRAMMER DEFINED EXCEPTION AND A REDECLARED
26
-- PREDEFINED EXCEPTION MAY BE PROPAGATED OUT OF SCOPE AND BACK IN,
27
-- WITH OUT-OF-SCOPE 'OTHERS' HANDLERS HANDLING THE EXCEPTION
28
-- INSTEAD OF OTHER HANDLERS. SEPARATELY COMPILED UNITS ARE NOT TESTED.
29
 
30
-- DAT 4/15/81
31
-- SPS 1/14/82
32
 
33
WITH REPORT; USE REPORT;
34
 
35
PROCEDURE CB4009A IS
36
 
37
     E : EXCEPTION;
38
 
39
     I : INTEGER := 0;
40
 
41
     PROCEDURE P1 (C : INTEGER);
42
     PROCEDURE P2 (C : INTEGER);
43
     PROCEDURE P3 (C : INTEGER);
44
 
45
     F : BOOLEAN := FALSE;
46
     T : CONSTANT BOOLEAN := TRUE;
47
 
48
     PROCEDURE P1 (C : INTEGER) IS
49
     BEGIN
50
          P3(C);
51
     EXCEPTION
52
          WHEN E => F := T;
53
          WHEN CONSTRAINT_ERROR => F := T;
54
          WHEN OTHERS => I := I + 1; RAISE;
55
     END P1;
56
 
57
     PROCEDURE P2 (C : INTEGER) IS
58
          E : EXCEPTION;
59
          CONSTRAINT_ERROR : EXCEPTION;
60
     BEGIN
61
          CASE C IS
62
               WHEN 0 => FAILED ("WRONG CASE");
63
               WHEN 1 => RAISE E;
64
               WHEN -1 => RAISE CONSTRAINT_ERROR;
65
               WHEN OTHERS => P1 (C - C/ABS(C));
66
          END CASE;
67
     EXCEPTION
68
          WHEN E =>
69
               I := I + 100; RAISE;
70
          WHEN CONSTRAINT_ERROR =>
71
               I := I + 101; RAISE;
72
          WHEN OTHERS =>
73
               F := T;
74
     END P2;
75
 
76
     PROCEDURE P3 (C : INTEGER) IS
77
     BEGIN
78
          P2(C);
79
     EXCEPTION
80
          WHEN E => F := T;
81
          WHEN CONSTRAINT_ERROR => F := T;
82
     END P3;
83
 
84
BEGIN
85
     TEST ("CB4009A", "EXCEPTIONS PROPAGATED OUT OF SCOPE");
86
 
87
     I := 0;
88
     BEGIN
89
          P3 (-2);
90
          FAILED ("EXCEPTION NOT RAISED 1");
91
     EXCEPTION
92
          WHEN OTHERS => NULL;
93
     END;
94
     IF I /= 203 THEN
95
          FAILED ("INCORRECT HANDLER SOMEWHERE 1");
96
     END IF;
97
 
98
     I := 0;
99
     BEGIN
100
          P3(3);
101
          FAILED ("EXCEPTION NOT RAISED 2");
102
     EXCEPTION
103
          WHEN OTHERS => NULL;
104
     END;
105
     IF I /= 302 THEN
106
          FAILED ("INCORRECT HANDLER SOMEWHERE 2");
107
     END IF;
108
 
109
     IF F = T THEN
110
          FAILED ("WRONG HANDLER SOMEWHERE");
111
     END IF;
112
 
113
     RESULT;
114
END CB4009A;

powered by: WebSVN 2.1.0

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