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/] [c3/] [c37208b.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C37208B.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
-- FOR A TYPE WITH DEFAULT DISCRIMINANT VALUES, CHECK THAT A
26
-- DISCRIMINANT CONSTRAINT CAN BE OMITTED IN A GENERIC FORMAL
27
-- PARAMETER, AND HENCE, FOR BOTH IN AND IN OUT PARAMETERS, THE
28
-- 'CONSTRAINED ATTRIBUTE OF THE ACTUAL PARAMETER BECOMES THE
29
-- 'CONSTRAINED ATTRIBUTE OF THE FORMAL PARAMETER, AND, FOR IN
30
-- OUT PARAMETERS, IF THE 'CONSTRAINED ATTRIBUTE IS FALSE,
31
-- ASSIGNMENTS TO THE FORMAL PARAMETERS CAN CHANGE THE
32
-- DISCRIMINANTS OF THE ACTUAL PARAMETER; IF THE 'CONSTRAINED
33
-- ATTRIBUTE IS  TRUE, ASSIGNMENTS THAT ATTEMPT TO CHANGE THE
34
-- DISCRIMINANTS OF THE ACTUAL PARAMETER RAISE CONSTRAINT_ERROR.
35
 
36
-- ASL 7/29/81
37
-- VKG 1/20/83
38
-- EDS 7/16/98    AVOID OPTIMIZATION
39
 
40
WITH REPORT;
41
PROCEDURE C37208B IS
42
 
43
     USE REPORT;
44
 
45
BEGIN
46
     TEST ("C37208B","FOR TYPES WITH DEFAULT DISCRIMINANT " &
47
            "VALUES, DISCRIMINANT CONSTRAINTS CAN BE OMITTED " &
48
            "IN GENERIC FORMAL PARAMETERS, AND THE " &
49
            "'CONSTRAINED ATTRIBUTE HAS CORRECT VALUES " &
50
            "DEPENDING ON THE ACTUAL PARAMETERS");
51
 
52
     DECLARE
53
          TYPE REC(DISC : INTEGER := 7) IS
54
               RECORD
55
                    NULL;
56
               END RECORD;
57
 
58
          KC : CONSTANT REC(3) := (DISC => 3);
59
          KU : CONSTANT REC := (DISC => 3);
60
          OBJC1,OBJC2 : REC(3) := (DISC => 3);
61
          OBJU1,OBJU2 : REC := (DISC => 3);
62
 
63
          GENERIC
64
               P_IN1 : REC;
65
               P_IN2 : REC;
66
               P_IN_OUT : IN OUT REC;
67
               STATUS : BOOLEAN;
68
          PROCEDURE PROC;
69
 
70
          PROCEDURE PROC IS
71
          BEGIN
72
 
73
               IF P_IN1'CONSTRAINED /= TRUE  OR
74
                  P_IN2'CONSTRAINED /= TRUE  OR
75
                  P_IN_OUT'CONSTRAINED /= STATUS
76
               THEN
77
 
78
                    FAILED ("'CONSTRAINED ATTRIBUTES DO NOT MATCH " &
79
                            "FOR ACTUAL AND FORMAL PARAMETERS");
80
               END IF;
81
               IF NOT STATUS THEN
82
                    BEGIN
83
                         P_IN_OUT := (DISC => IDENT_INT(7));
84
                    EXCEPTION
85
                         WHEN OTHERS =>
86
                              FAILED ("EXCEPTION RAISED " &
87
                                      "WHEN TRYING TO " &
88
                                      "CHANGE UNCONSTRAINED " &
89
                                      "DISCRIMINANT VALUE");
90
                    END;
91
               ELSE
92
                    BEGIN
93
                         P_IN_OUT := (DISC => IDENT_INT(7));
94
                         FAILED ("DISCRIMINANT OF CONSTRAINED " &
95
                                 "ACTUAL PARAMETER ILLEGALLY " &
96
                                 "CHANGED BY ASSIGNMENT");
97
                    EXCEPTION
98
                         WHEN CONSTRAINT_ERROR => NULL;
99
                         WHEN OTHERS => FAILED ("WRONG EXCEPTION");
100
                    END;
101
               END IF;
102
          END PROC;
103
 
104
     BEGIN
105
 
106
          DECLARE
107
               PROCEDURE PROC_C IS NEW PROC(KC,OBJC1,OBJC2,IDENT_BOOL(TRUE));
108
               PROCEDURE PROC_U IS NEW PROC(KU,OBJU1,OBJU2,IDENT_BOOL(FALSE));
109
          BEGIN
110
               PROC_C;
111
               PROC_U;
112
               IF OBJU2.DISC /= 7 THEN
113
               FAILED ("ASSIGNMENT TO UNCONSTRAINED ACTUAL " &
114
                       "PARAMETER FAILED TO CHANGE DISCRIMINANT ");
115
               END IF;
116
          END;
117
 
118
     END;
119
     RESULT;
120
END C37208B;

powered by: WebSVN 2.1.0

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