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/] [c6/] [c64103f.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
-- C64103F.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, FOR OUT PARAMETERS OF AN ACCESS TYPE,
27
--     CONSTRAINT_ERROR IS RAISED:
28
--          AFTER A SUBPROGRAM CALL WHEN THE BOUNDS OR DISCRIMINANTS
29
--          OF THE FORMAL DESIGNATED PARAMETER ARE DIFFERENT FROM
30
--          THOSE OF THE ACTUAL DESIGNATED PARAMETER.
31
 
32
-- HISTORY:
33
--     CPP  07/23/84  CREATED ORIGINAL TEST.
34
--     VCL  10/27/87  MODIFIED THIS HEADER; ADDED STATEMENTS WHICH
35
--                    REFERENCE THE ACTUAL PARAMETERS.
36
 
37
WITH REPORT;  USE REPORT;
38
PROCEDURE C64103F IS
39
BEGIN
40
     TEST ("C64103F", "FOR OUT PARAMETERS OF AN ACCESS TYPE, " &
41
                      "CONSTRAINT_ERROR IS RAISED:  AFTER A " &
42
                      "SUBPROGRAM CALL WHEN THE BOUNDS OR " &
43
                      "DISCRIMINANTS OF THE FORMAL DESIGNATED " &
44
                      "PARAMETER ARE DIFFERENT FROM THOSE OF THE " &
45
                      "ACTUAL DESIGNATED PARAMETER");
46
 
47
 
48
     BEGIN
49
          DECLARE
50
               TYPE AST IS ACCESS STRING;
51
               SUBTYPE AST_3 IS AST(IDENT_INT(1)..IDENT_INT(3));
52
               SUBTYPE AST_5 IS AST(3..5);
53
               X_3 : AST_3 := NEW STRING'(1..IDENT_INT(3) => 'A');
54
               CALLED : BOOLEAN := FALSE;
55
 
56
               PROCEDURE P1 (X : OUT AST_5) IS
57
               BEGIN
58
                    CALLED := TRUE;
59
                    X := NEW STRING'(3..5 => 'C');
60
               END P1;
61
          BEGIN
62
               P1 (AST_5 (X_3));
63
               IF X_3.ALL = STRING'(1 .. 3 => 'A') THEN
64
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A1)");
65
               ELSE
66
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P1 (A2)");
67
               END IF;
68
          EXCEPTION
69
               WHEN CONSTRAINT_ERROR =>
70
                    IF NOT CALLED THEN
71
                         FAILED ("EXCEPTION RAISED BEFORE CALL " &
72
                                 "-P1 (A)");
73
                    END IF;
74
               WHEN OTHERS =>
75
                    FAILED ("WRONG EXCEPTION RAISED -P1 (A)");
76
          END;
77
 
78
          DECLARE
79
               TYPE ARRAY_TYPE IS ARRAY (INTEGER RANGE <>) OF BOOLEAN;
80
               TYPE A_ARRAY IS ACCESS ARRAY_TYPE;
81
               SUBTYPE A1_ARRAY IS A_ARRAY (1..IDENT_INT(3));
82
               TYPE A2_ARRAY IS NEW A_ARRAY (2..4);
83
               A0 : A1_ARRAY := NEW ARRAY_TYPE'(1..3 => TRUE);
84
               CALLED : BOOLEAN := FALSE;
85
 
86
               PROCEDURE P2 (X : OUT A2_ARRAY) IS
87
               BEGIN
88
                    CALLED := TRUE;
89
                    X := NEW ARRAY_TYPE'(2..4 => FALSE);
90
               END P2;
91
          BEGIN
92
               P2 (A2_ARRAY (A0));
93
               IF A0.ALL = ARRAY_TYPE'(1 .. 3 => TRUE) THEN
94
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A1)");
95
               ELSE
96
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P2 (A2)");
97
               END IF;
98
          EXCEPTION
99
               WHEN CONSTRAINT_ERROR =>
100
                    IF NOT CALLED THEN
101
                         FAILED ("EXCEPTION RAISED BEFORE CALL " &
102
                                 "-P1 (A)");
103
                    END IF;
104
               WHEN OTHERS =>
105
                    FAILED ("WRONG EXCEPTION RAISED -P2 (A)");
106
          END;
107
 
108
          DECLARE
109
               TYPE SUBINT IS RANGE 0..8;
110
               TYPE REC1 (DISC : SUBINT := 8) IS
111
                    RECORD
112
                         FIELD : SUBINT := DISC;
113
                    END RECORD;
114
               TYPE A1_REC IS ACCESS REC1;
115
               TYPE A2_REC IS NEW A1_REC (3);
116
               A0 : A1_REC(4) := NEW REC1(4);
117
               CALLED : BOOLEAN := FALSE;
118
 
119
               PROCEDURE P3 (X : OUT A2_REC) IS
120
               BEGIN
121
                    CALLED := TRUE;
122
                    X := NEW REC1(3);
123
               END P3;
124
 
125
          BEGIN
126
               P3 (A2_REC (A0));
127
               IF A0.ALL = REC1'(4,4) THEN
128
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A1)");
129
               ELSE
130
                    FAILED ("EXCEPTION NOT RAISED AFTER CALL -P3 (A2)");
131
               END IF;
132
          EXCEPTION
133
               WHEN CONSTRAINT_ERROR =>
134
                    IF NOT CALLED THEN
135
                         FAILED ("EXCEPTION RAISED BEFORE CALL " &
136
                                 "-P1 (A)");
137
                    END IF;
138
               WHEN OTHERS =>
139
                    FAILED ("WRONG EXCEPTION RAISED -P3 (A)");
140
          END;
141
     END;
142
 
143
     RESULT;
144
END C64103F;

powered by: WebSVN 2.1.0

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