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/] [cb4003a.ada] - Blame information for rev 309

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

Line No. Rev Author Line
1 294 jeremybenn
-- CB4003A.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
-- OBJECTIVE:
26
--     CHECK THAT EXCEPTIONS RAISED DURING ELABORATION OF PACKAGE
27
--     SPECIFICATIONS, OR DECLARATIVE_PARTS OF BLOCKS AND PACKAGE
28
--     BODIES, ARE PROPAGATED TO THE STATIC ENVIRONMENT.  EXCEPTIONS
29
--     ARE CAUSED BY INITIALIZATIONS AND FUNCTION CALLS.
30
 
31
-- HISTORY:
32
--     DAT 04/14/81  CREATED ORIGINAL TEST.
33
--     JET 01/06/88  UPDATED HEADER FORMAT AND ADDED CODE TO
34
--                   PREVENT OPTIMIZATION.
35
 
36
WITH REPORT; USE REPORT;
37
 
38
PROCEDURE CB4003A IS
39
 
40
     E : EXCEPTION;
41
 
42
     FUNCTION F (B : BOOLEAN) RETURN INTEGER IS
43
     BEGIN
44
          IF B THEN
45
               RAISE E;
46
          ELSE
47
               RETURN 1;
48
          END IF;
49
     END F;
50
 
51
BEGIN
52
     TEST ("CB4003A", "CHECK THAT EXCEPTIONS DURING ELABORATION"
53
          & " OF DECLARATIVE PARTS"
54
          & " IN BLOCKS, PACKAGE SPECS, AND PACKAGE BODIES ARE"
55
          & " PROPAGATED TO STATIC ENCLOSING ENVIRONMENT");
56
 
57
     BEGIN
58
          DECLARE
59
               PACKAGE P1 IS
60
                    I : INTEGER RANGE 1 .. 1 := 2;
61
               END P1;
62
          BEGIN
63
               FAILED ("EXCEPTION NOT RAISED 1");
64
               IF NOT EQUAL(P1.I,P1.I) THEN
65
                    COMMENT ("NO EXCEPTION RAISED");
66
               END IF;
67
          EXCEPTION
68
               WHEN OTHERS => FAILED ("WRONG HANDLER 1");
69
          END;
70
          FAILED ("EXCEPTION NOT RAISED 1A");
71
     EXCEPTION
72
          WHEN CONSTRAINT_ERROR =>NULL;
73
          WHEN OTHERS => FAILED ("WRONG EXCEPTION 1");
74
     END;
75
 
76
     FOR L IN IDENT_INT(1) .. IDENT_INT(4) LOOP
77
          BEGIN
78
               DECLARE
79
                    PACKAGE P2 IS
80
                    PRIVATE
81
                         J : INTEGER RANGE 2 .. 4 := L;
82
                    END P2;
83
 
84
                    Q : INTEGER := F(L = 3);
85
 
86
                    PACKAGE BODY P2 IS
87
                         K : INTEGER := F(L = 2);
88
 
89
                    BEGIN
90
                         IF NOT (EQUAL(J,J) OR EQUAL(K,K)) THEN
91
                              COMMENT("CAN'T OPTIMIZE THIS");
92
                         END IF;
93
                    END P2;
94
               BEGIN
95
                    IF L /= 4 THEN
96
                         FAILED ("EXCEPTION NOT RAISED 2");
97
                    END IF;
98
 
99
                    IF NOT EQUAL(Q,Q) THEN
100
                         COMMENT("CAN'T OPTIMIZE THIS");
101
                    END IF;
102
 
103
                    EXIT;
104
               EXCEPTION
105
                    WHEN OTHERS =>
106
                         FAILED ("WRONG EXCEPTION HANDLER 2");
107
                         EXIT;
108
               END;
109
               FAILED ("EXCEPTION NOT RAISED 2A");
110
          EXCEPTION
111
               WHEN E | CONSTRAINT_ERROR =>
112
                    NULL;
113
               WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED 2");
114
          END;
115
     END LOOP;
116
 
117
     RESULT;
118
 
119
END CB4003A;

powered by: WebSVN 2.1.0

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