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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C38107A.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
--     FOR AN INCOMPLETE TYPE WITH DISCRIMINANTS DECLARED IN THE
27
--     VISIBLE PART OF A PACKAGE OR IN A DECLARATIVE PART, CHECK THAT
28
--     CONSTRAINT_ERROR IS RAISED IF A DISCRIMINANT CONSTRAINT IS
29
--     SPECIFIED FOR THE TYPE AND ONE OF THE DISCRIMINANT VALUES DOES
30
--     NOT BELONG TO THE CORRESPONDING DISCRIMINANT'S SUBTYPE.
31
 
32
-- HISTORY:
33
--     BCB 01/21/88  CREATED ORIGINAL TEST.
34
 
35
WITH REPORT; USE REPORT;
36
 
37
PROCEDURE C38107A IS
38
 
39
BEGIN
40
     TEST ("C38107A", "FOR AN INCOMPLETE TYPE WITH DISCRIMINANTS " &
41
                      "DECLARED IN THE VISIBLE PART OF A PACKAGE OR " &
42
                      "IN A DECLARATIVE PART, CHECK THAT CONSTRAINT_" &
43
                      "ERROR IS RAISED IF A DISCRIMINANT CONSTRAINT " &
44
                      "IS SPECIFIED FOR THE TYPE AND ONE OF THE " &
45
                      "DISCRIMINANT VALUES DOES NOT BELONG TO THE " &
46
                      "CORRESPONDING DISCRIMINANT'S SUBTYPE");
47
 
48
     BEGIN
49
          DECLARE
50
               PACKAGE P IS
51
                    SUBTYPE INT6 IS INTEGER RANGE 1 .. 6;
52
                    TYPE T_INT6 (D6 : INT6);
53
                    TYPE TEST IS ACCESS T_INT6(7);  -- CONSTRAINT_ERROR.
54
                    TYPE T_INT6 (D6 : INT6) IS
55
                         RECORD
56
                              NULL;
57
                         END RECORD;
58
               END P;
59
               USE P;
60
          BEGIN
61
               FAILED ("CONSTRAINT_ERROR WAS NOT RAISED - 1");
62
               DECLARE
63
                    T : P.TEST := NEW T_INT6(7);
64
               BEGIN
65
                    IF EQUAL(T.D6, T.D6) THEN
66
                         COMMENT ("DON'T OPTIMIZE T.D6");
67
                    END IF;
68
               END;
69
          END;
70
     EXCEPTION
71
          WHEN CONSTRAINT_ERROR =>
72
               NULL;
73
          WHEN OTHERS =>
74
               FAILED ("AN EXCEPTION OTHER THAN CONSTRAINT_ERROR " &
75
                       "WAS RAISED - 1");
76
     END;
77
 
78
     BEGIN
79
          DECLARE
80
               SUBTYPE INT7 IS INTEGER RANGE 1 .. 7;
81
               TYPE T_INT7 (D7 : INT7);
82
               TYPE TEST IS ACCESS T_INT7(8);       -- CONSTRAINT_ERROR.
83
               TYPE T_INT7 (D7 : INT7) IS
84
                    RECORD
85
                         NULL;
86
                    END RECORD;
87
          BEGIN
88
               FAILED ("CONSTRAINT_ERROR WAS NOT RAISED - 2");
89
               DECLARE
90
                    T : TEST := NEW T_INT7(6);
91
               BEGIN
92
                    IF EQUAL(T.D7, T.D7) THEN
93
                         COMMENT ("DON'T OPTIMIZE T.D7");
94
                    END IF;
95
               END;
96
          END;
97
     EXCEPTION
98
          WHEN CONSTRAINT_ERROR =>
99
               NULL;
100
          WHEN OTHERS =>
101
               FAILED ("AN EXCEPTION OTHER THAN CONSTRAINT_ERROR " &
102
                       "WAS RAISED - 2");
103
     END;
104
     RESULT;
105
END C38107A;

powered by: WebSVN 2.1.0

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