OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [c8/] [c83e02a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C83E02A.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 WITHIN THE BODY OF A SUBPROGRAM A FORMAL PARAMETER CAN BE
26
--    USED DIRECTLY IN A RANGE CONSTRAINT, A DISCRIMINANT CONSTRAINT,
27
--    AND AN INDEX CONSTRAINT.
28
 
29
--    RM    8 JULY 1980
30
 
31
 
32
WITH REPORT;
33
PROCEDURE  C83E02A  IS
34
 
35
     USE REPORT;
36
 
37
     Z : INTEGER := 0 ;
38
 
39
     PROCEDURE  P1 ( A , B : INTEGER;  C : IN OUT INTEGER ) IS
40
          X : INTEGER RANGE A+1..1+B ;
41
     BEGIN
42
          X := A + 1 ;
43
          C := X * B + B * X * A ;         -- 4*3+3*4*3=48
44
     END ;
45
 
46
     PROCEDURE  P2 ( A , B : INTEGER;  C : IN OUT INTEGER ) IS
47
          TYPE  T (MAX : INTEGER)  IS
48
               RECORD
49
                    VALUE : INTEGER RANGE 1..3 ;
50
               END RECORD ;
51
          X : T(A);
52
     BEGIN
53
          X := ( MAX => 4 , VALUE => B ) ; -- ( 4 , 3 )
54
          C := 10*C + X.VALUE + 2 ;        -- 10*48+3+2=485
55
     END ;
56
 
57
     FUNCTION  F3 ( A , B : INTEGER )  RETURN INTEGER  IS
58
          TYPE  TABLE  IS  ARRAY( A..B ) OF INTEGER ;
59
          X : TABLE ;
60
          Y : ARRAY( A..B ) OF INTEGER ;
61
     BEGIN
62
          X(A) := A ;                      -- 5
63
          Y(B) := B ;                      -- 6
64
          RETURN X(A)-Y(B)+4 ;             -- 3
65
     END ;
66
 
67
 
68
BEGIN
69
 
70
     TEST( "C83E02A" , "CHECK THAT WITHIN THE BODY OF A SUBPROGRAM " &
71
                       " A FORMAL PARAMETER CAN BE USED DIRECTLY IN" &
72
                       " A RANGE CONSTRAINT, A DISCRIMINANT CONSTRAINT"&
73
                       ", AND AN INDEX CONSTRAINT" ) ;
74
 
75
     P1 ( 3 , 3 , Z );                     --  Z  BECOMES  48
76
     P2 ( 4 , F3( 5 , 6 ) , Z );           --  Z  BECOMES 485
77
 
78
     IF  Z /= 485  THEN
79
          FAILED( "ACCESSING ERROR OR COMPUTATION ERROR" );
80
     END IF;
81
 
82
     RESULT;
83
 
84
END C83E02A;

powered by: WebSVN 2.1.0

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