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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C41205A.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
-- CHECK THAT CONSTRAINT_ERROR IS RAISED IF THE NAME PART OF A
26
--   SLICE DENOTES AN ACCESS OBJECT WHOSE VALUE IS NULL, AND
27
--   ALSO IF THE NAME IS A FUNCTION CALL DELIVERING NULL.
28
 
29
-- WKB 8/6/81
30
-- SPS 10/26/82
31
-- EDS 07/14/98    AVOID OPTIMIZATION
32
 
33
WITH REPORT;
34
USE REPORT;
35
PROCEDURE C41205A IS
36
 
37
BEGIN
38
     TEST ("C41205A", "CONSTRAINT_ERROR WHEN THE NAME PART OF A " &
39
                      "SLICE DENOTES A NULL ACCESS OBJECT OR A " &
40
                      "FUNCTION CALL DELIVERING NULL");
41
 
42
     DECLARE
43
 
44
          TYPE T IS ARRAY (INTEGER RANGE <> ) OF INTEGER;
45
          SUBTYPE T1 IS T (1..5);
46
          TYPE A1 IS ACCESS T1;
47
          B : A1 := NEW T1' (1,2,3,4,5);
48
          I : T (2..3);
49
 
50
     BEGIN
51
 
52
          IF EQUAL (3,3) THEN
53
               B := NULL;
54
          END IF;
55
 
56
          I := B(2..3);
57
          FAILED ("CONSTRAINT_ERROR NOT RAISED - 1 " & INTEGER'IMAGE(I(2)));
58
 
59
     EXCEPTION
60
 
61
          WHEN CONSTRAINT_ERROR => NULL;
62
          WHEN OTHERS           => FAILED ("WRONG EXCEPTION - 1");
63
 
64
     END;
65
 
66
     DECLARE
67
 
68
          TYPE T IS ARRAY (INTEGER RANGE <> ) OF INTEGER;
69
          SUBTYPE T2 IS T (1..5);
70
          TYPE A2 IS ACCESS T2;
71
          I : T (2..5);
72
 
73
          FUNCTION F RETURN A2 IS
74
          BEGIN
75
               IF EQUAL (3,3) THEN
76
                    RETURN NULL;
77
               END IF;
78
               RETURN NEW T2' (1,2,3,4,5);
79
          END F;
80
 
81
     BEGIN
82
 
83
          I := F(2..5);
84
          FAILED ("CONSTRAINT_ERROR NOT RAISED - 2 " & INTEGER'IMAGE(I(2)));
85
 
86
     EXCEPTION
87
 
88
          WHEN CONSTRAINT_ERROR => NULL;
89
          WHEN OTHERS           => FAILED ("WRONG EXCEPTION - 2");
90
 
91
     END;
92
 
93
     RESULT;
94
END C41205A;

powered by: WebSVN 2.1.0

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