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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C4A005B.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 A NONSTATIC UNIVERSAL INTEGER EXPRESSION RAISES
26
-- CONSTRAINT_ERROR IF DIVISION BY ZERO IS ATTEMPTED
27
-- OR IF THE SECOND OPERAND OF REM OR MOD IS ZERO.
28
 
29
-- *** NOTE: This test has been modified since ACVC version 1.11 to    -- 9X
30
-- ***       remove incompatibilities associated with the transition   -- 9X
31
-- ***       to Ada 9X.                                                -- 9X
32
-- ***                                                                 -- 9X
33
 
34
-- JBG 5/2/85
35
-- EG  10/24/85  FIX NUMERIC_ERROR/CONSTRAINT_ERROR ACCORDING TO
36
--               AI-00387; PREVENT DEAD VARIABLE OPTIMIZATION
37
-- MRM 03/30/93  REMOVE NUMERIC_ERROR FOR 9X COMPATIBILITY
38
 
39
WITH REPORT; USE REPORT;
40
PROCEDURE C4A005B IS
41
BEGIN
42
     TEST("C4A005B", "CHECK CONSTRAINT_ERROR FOR " &
43
                     "NONSTATIC UNIVERSAL " &
44
                     "INTEGER EXPRESSIONS - DIVISION BY ZERO");
45
     BEGIN
46
          DECLARE
47
               X : BOOLEAN := 1 = 1/INTEGER'POS(IDENT_INT(0));
48
          BEGIN
49
               FAILED ("CONSTRAINT_ERROR NOT RAISED - DIV");
50
               IF X /= IDENT_BOOL(X) THEN
51
                    FAILED ("WRONG RESULT - DIV");
52
               END IF;
53
          EXCEPTION
54
               WHEN OTHERS =>
55
                    FAILED ("EXCEPTION IN WRONG PLACE - DIV");
56
          END;
57
     EXCEPTION
58
          WHEN CONSTRAINT_ERROR =>
59
               COMMENT ("CONSTRAINT_ERROR RAISED FOR / BY 0");
60
          WHEN OTHERS =>
61
               FAILED ("WRONG EXCEPTION RAISED - DIV");
62
     END;
63
 
64
     BEGIN
65
          DECLARE
66
               X : BOOLEAN := 1 = 1 REM INTEGER'POS(IDENT_INT(0));
67
          BEGIN
68
               FAILED ("CONSTRAINT_ERROR NOT RAISED - REM");
69
               IF X /= IDENT_BOOL(X) THEN
70
                    FAILED ("WRONG RESULT - REM");
71
               END IF;
72
          EXCEPTION
73
               WHEN OTHERS =>
74
                    FAILED ("EXCEPTION IN WRONG PLACE - REM");
75
          END;
76
     EXCEPTION
77
          WHEN CONSTRAINT_ERROR =>
78
               COMMENT ("CONSTRAINT_ERROR RAISED FOR REM BY 0");
79
          WHEN OTHERS =>
80
               FAILED ("WRONG EXCEPTION RAISED - REM");
81
     END;
82
 
83
     BEGIN
84
          DECLARE
85
               X : BOOLEAN := 1 = INTEGER'POS(IDENT_INT(1)) MOD 0;
86
          BEGIN
87
               FAILED ("CONSTRAINT_ERROR NOT RAISED - MOD");
88
               IF X /= IDENT_BOOL(X) THEN
89
                    FAILED ("WRONG RESULT - MOD");
90
               END IF;
91
          EXCEPTION
92
               WHEN OTHERS =>
93
                    FAILED ("EXCEPTION IN WRONG PLACE - MOD");
94
          END;
95
     EXCEPTION
96
          WHEN CONSTRAINT_ERROR =>
97
               COMMENT ("CONSTRAINT_ERROR RAISED FOR MOD BY 0");
98
          WHEN OTHERS =>
99
               FAILED ("WRONG EXCEPTION RAISED - MOD");
100
     END;
101
 
102
     RESULT;
103
 
104
END C4A005B;

powered by: WebSVN 2.1.0

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