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/] [c64104n.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
-- C64104N.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 CONSTRAINT_ERROR IS RAISED AT THE PLACE OF THE CALL
27
--     FOR THE CASE OF A PRIVATE TYPE IMPLEMENTED AS A SCALAR TYPE
28
--     WHERE THE VALUE OF THE FORMAL PARAMETER DOES NOT BELONG TO THE
29
--     SUBTYPE OF THE ACTUAL PARAMETER.
30
 
31
-- HISTORY:
32
--     DAVID A. TAFFS
33
--     CPP 07/23/84
34
--     RDH 04/18/90  REVISED TO CHECK THAT SUBPROGRAM IS ACTUALLY
35
--                   CALLED.
36
--     THS 09/21/90  REWORDED COMMENT STATING THAT THE TEST DOES NOT
37
--                   ACCEPT THE LITERAL INTERPRETATION OF 6.4.1(9).
38
 
39
WITH REPORT; USE REPORT;
40
PROCEDURE C64104N IS
41
 
42
BEGIN
43
     TEST ("C64104N", "CHECK THAT PRIVATE TYPE (SCALAR) RAISES " &
44
           "CONSTRAINT_ERROR WHEN ACTUAL AND FORMAL PARAMETER " &
45
           "BOUNDS DIFFER");
46
 
47
     DECLARE
48
 
49
          CALLED : BOOLEAN := FALSE;
50
 
51
          PACKAGE P IS
52
               TYPE T IS PRIVATE;
53
               DC : CONSTANT T;
54
 
55
               GENERIC PACKAGE PP IS
56
               END PP;
57
          PRIVATE
58
               TYPE T IS NEW INTEGER;
59
               DC : CONSTANT T := -1;
60
          END P;
61
 
62
          PROCEDURE Q (X : IN OUT P.T) IS
63
          BEGIN
64
               CALLED := TRUE;
65
               X := P.DC;
66
               IF P. "=" (X, P.DC) THEN
67
                    COMMENT("PROCEDURE Q WAS CALLED");
68
               END IF;
69
          EXCEPTION
70
               WHEN OTHERS =>
71
                    FAILED("EXCEPTION RAISED INSIDE SUBPROGRAM");
72
          END Q;
73
 
74
          GENERIC
75
               Y : IN OUT P.T;
76
          PACKAGE CALL IS
77
          END CALL;
78
 
79
          PACKAGE BODY CALL IS
80
          BEGIN
81
               Q (Y);
82
          END CALL;
83
 
84
-- NOTE CALL HAS VARIABLE OF A PRIVATE TYPE AS AN OUT PARAMETER.  
85
-- THIS TEST DOES NOT ACCEPT THE LITERAL INTERPRETATION OF 6.4.1(9).
86
-- REFER TO ADA IMPLEMENTOR'S GUIDE 6.4.1 SEMANTIC RAMIFICATION 19
87
-- AND AI-00025 FOR CLARIFICATION AS TO WHY THE LITERAL
88
-- INTERPRETATION IS REJECTED.
89
 
90
          PACKAGE BODY P IS
91
               Z : T RANGE 0..1 := 0;
92
               PACKAGE BODY PP IS
93
                    PACKAGE CALL_Q IS NEW CALL(Z);
94
               END PP;
95
          END P;
96
 
97
     BEGIN
98
          BEGIN
99
               DECLARE
100
                    PACKAGE CALL_Q_NOW IS NEW P.PP;    -- EXCEPTION
101
               BEGIN
102
                    FAILED ("NO EXCEPTION RAISED");
103
               END;
104
          EXCEPTION
105
               WHEN CONSTRAINT_ERROR =>
106
                    IF NOT CALLED THEN
107
                         FAILED("SUBPROGRAM Q WAS NOT CALLED");
108
                    END IF;
109
               WHEN OTHERS =>
110
                    FAILED("WRONG EXCEPTION RAISED");
111
          END;
112
 
113
          RESULT;
114
 
115
     END;
116
END C64104N;

powered by: WebSVN 2.1.0

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