-- C460010.A
|
-- C460010.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that, for an array aggregate without an others choice assigned
|
-- Check that, for an array aggregate without an others choice assigned
|
-- to an object of a constrained array subtype, Constraint_Error is not
|
-- to an object of a constrained array subtype, Constraint_Error is not
|
-- raised if the length of each dimension of the aggregate equals the
|
-- raised if the length of each dimension of the aggregate equals the
|
-- length of the corresponding dimension of the target object, even if
|
-- length of the corresponding dimension of the target object, even if
|
-- the bounds of the corresponding index ranges do not match.
|
-- the bounds of the corresponding index ranges do not match.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- The test verifies that sliding of array bounds is performed on array
|
-- The test verifies that sliding of array bounds is performed on array
|
-- aggregates that are part of a larger aggregate, where the bounds of
|
-- aggregates that are part of a larger aggregate, where the bounds of
|
-- the corresponding index ranges do not match but the lengths of the
|
-- the corresponding index ranges do not match but the lengths of the
|
-- corresponding dimensions are the same. Both aggregates containing
|
-- corresponding dimensions are the same. Both aggregates containing
|
-- named associations and positional associations are checked. Cases
|
-- named associations and positional associations are checked. Cases
|
-- involving static and nonstatic index constraints, as well as pre-
|
-- involving static and nonstatic index constraints, as well as pre-
|
-- defined and modular integer index subtypes, are included.
|
-- defined and modular integer index subtypes, are included.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 15 Apr 96 SAIC Prerelease version for ACVC 2.1.
|
-- 15 Apr 96 SAIC Prerelease version for ACVC 2.1.
|
-- 20 Oct 96 SAIC Removed unnecessary parentheses and type
|
-- 20 Oct 96 SAIC Removed unnecessary parentheses and type
|
-- conversions.
|
-- conversions.
|
--
|
--
|
--!
|
--!
|
|
|
with Report;
|
with Report;
|
pragma Elaborate (Report);
|
pragma Elaborate (Report);
|
|
|
package C460010_0 is
|
package C460010_0 is
|
|
|
type Modular_Type is mod 10; -- Range 0 .. 9.
|
type Modular_Type is mod 10; -- Range 0 .. 9.
|
|
|
|
|
Two : Modular_Type := Modular_Type (Report.Ident_Int(2));
|
Two : Modular_Type := Modular_Type (Report.Ident_Int(2));
|
Four : Modular_Type := Modular_Type (Report.Ident_Int(4));
|
Four : Modular_Type := Modular_Type (Report.Ident_Int(4));
|
|
|
type Array_Modular_Index is array (Modular_Type range <>) of Integer;
|
type Array_Modular_Index is array (Modular_Type range <>) of Integer;
|
|
|
subtype Array_Static_Modular_Constraint is Array_Modular_Index(2..4);
|
subtype Array_Static_Modular_Constraint is Array_Modular_Index(2..4);
|
subtype Array_Nonstatic_Modular_Constraint is Array_Modular_Index(Two..Four);
|
subtype Array_Nonstatic_Modular_Constraint is Array_Modular_Index(Two..Four);
|
|
|
end C460010_0;
|
end C460010_0;
|
|
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
|
|
with Report;
|
with Report;
|
pragma Elaborate (Report);
|
pragma Elaborate (Report);
|
|
|
package C460010_1 is
|
package C460010_1 is
|
|
|
One : Integer := Report.Ident_Int(1);
|
One : Integer := Report.Ident_Int(1);
|
Ten : Integer := Report.Ident_Int(10);
|
Ten : Integer := Report.Ident_Int(10);
|
|
|
subtype Integer_Subtype is Integer range One .. Ten;
|
subtype Integer_Subtype is Integer range One .. Ten;
|
|
|
|
|
Two : Integer := Report.Ident_Int(2);
|
Two : Integer := Report.Ident_Int(2);
|
Four : Integer := Report.Ident_Int(4);
|
Four : Integer := Report.Ident_Int(4);
|
|
|
type Array_Integer_Index is array (Integer_Subtype range <>) of Boolean;
|
type Array_Integer_Index is array (Integer_Subtype range <>) of Boolean;
|
|
|
subtype Array_Static_Integer_Constraint is Array_Integer_Index(2..4);
|
subtype Array_Static_Integer_Constraint is Array_Integer_Index(2..4);
|
subtype Array_Nonstatic_Integer_Constraint is Array_Integer_Index(Two..Four);
|
subtype Array_Nonstatic_Integer_Constraint is Array_Integer_Index(Two..Four);
|
|
|
end C460010_1;
|
end C460010_1;
|
|
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
|
|
-- Generic equality function:
|
-- Generic equality function:
|
|
|
generic
|
generic
|
type Operand_Type is private;
|
type Operand_Type is private;
|
function C460010_2 (L, R : Operand_Type) return Boolean;
|
function C460010_2 (L, R : Operand_Type) return Boolean;
|
|
|
|
|
function C460010_2 (L, R : Operand_Type) return Boolean is
|
function C460010_2 (L, R : Operand_Type) return Boolean is
|
begin
|
begin
|
return L = R;
|
return L = R;
|
end C460010_2;
|
end C460010_2;
|
|
|
|
|
--==================================================================--
|
--==================================================================--
|
|
|
|
|
with C460010_0;
|
with C460010_0;
|
with C460010_1;
|
with C460010_1;
|
with C460010_2;
|
with C460010_2;
|
|
|
with Report;
|
with Report;
|
|
|
procedure C460010 is
|
procedure C460010 is
|
|
|
generic function Generic_Equality renames C460010_2;
|
generic function Generic_Equality renames C460010_2;
|
|
|
begin
|
begin
|
Report.Test ("C460010", "Check that Constraint_Error is not raised if " &
|
Report.Test ("C460010", "Check that Constraint_Error is not raised if " &
|
"an array aggregate without an others choice is assigned " &
|
"an array aggregate without an others choice is assigned " &
|
"to an object of a constrained array subtype, and the " &
|
"to an object of a constrained array subtype, and the " &
|
"length of each dimension of the aggregate equals the " &
|
"length of each dimension of the aggregate equals the " &
|
"length of the corresponding dimension of the target object");
|
"length of the corresponding dimension of the target object");
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
declare
|
declare
|
type Arr is array (1..1) of C460010_0.Array_Static_Modular_Constraint;
|
type Arr is array (1..1) of C460010_0.Array_Static_Modular_Constraint;
|
function Equals is new Generic_Equality (Arr);
|
function Equals is new Generic_Equality (Arr);
|
Target : Arr;
|
Target : Arr;
|
begin
|
begin
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
CASE_1:
|
CASE_1:
|
begin
|
begin
|
Target := (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
|
Target := (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 1");
|
Report.Failed ("Constraint_Error raised: Case 1");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 1");
|
Report.Failed ("Unexpected exception raised: Case 1");
|
end CASE_1;
|
end CASE_1;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
|
|
CASE_2:
|
CASE_2:
|
begin
|
begin
|
Target := (1 => (5, 10, 15)); -- Positional associations.
|
Target := (1 => (5, 10, 15)); -- Positional associations.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 2");
|
Report.Failed ("Constraint_Error raised: Case 2");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 2");
|
Report.Failed ("Unexpected exception raised: Case 2");
|
end CASE_2;
|
end CASE_2;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
end;
|
end;
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
declare
|
declare
|
type Rec (Disc : C460010_0.Modular_Type := 4) is record
|
type Rec (Disc : C460010_0.Modular_Type := 4) is record
|
Arr : C460010_0.Array_Modular_Index(2 .. Disc);
|
Arr : C460010_0.Array_Modular_Index(2 .. Disc);
|
end record;
|
end record;
|
|
|
function Equals is new Generic_Equality (Rec);
|
function Equals is new Generic_Equality (Rec);
|
Target : Rec;
|
Target : Rec;
|
begin
|
begin
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
CASE_3:
|
CASE_3:
|
begin
|
begin
|
Target := (Disc => 4, Arr => (1 => 1, 2 => 2, 3 => 3)); -- Named.
|
Target := (Disc => 4, Arr => (1 => 1, 2 => 2, 3 => 3)); -- Named.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 3");
|
Report.Failed ("Constraint_Error raised: Case 3");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 3");
|
Report.Failed ("Unexpected exception raised: Case 3");
|
end CASE_3;
|
end CASE_3;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
|
|
CASE_4:
|
CASE_4:
|
begin
|
begin
|
Target := (Disc => 4, Arr => (1 ,2, 3)); -- Positional.
|
Target := (Disc => 4, Arr => (1 ,2, 3)); -- Positional.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 4");
|
Report.Failed ("Constraint_Error raised: Case 4");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 4");
|
Report.Failed ("Unexpected exception raised: Case 4");
|
end CASE_4;
|
end CASE_4;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
end;
|
end;
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
declare
|
declare
|
type Arr is array (1..1) of C460010_0.Array_Nonstatic_Modular_Constraint;
|
type Arr is array (1..1) of C460010_0.Array_Nonstatic_Modular_Constraint;
|
function Equals is new Generic_Equality (Arr);
|
function Equals is new Generic_Equality (Arr);
|
Target : Arr;
|
Target : Arr;
|
begin
|
begin
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
CASE_5:
|
CASE_5:
|
begin
|
begin
|
Target := (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
|
Target := (1 => (1 => 1, 2 => 2, 3 => 3)); -- Named associations.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 5");
|
Report.Failed ("Constraint_Error raised: Case 5");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 5");
|
Report.Failed ("Unexpected exception raised: Case 5");
|
end CASE_5;
|
end CASE_5;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
|
|
CASE_6:
|
CASE_6:
|
begin
|
begin
|
Target := (1 => ((5, 10, 15))); -- Positional associations.
|
Target := (1 => ((5, 10, 15))); -- Positional associations.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 6");
|
Report.Failed ("Constraint_Error raised: Case 6");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 6");
|
Report.Failed ("Unexpected exception raised: Case 6");
|
end CASE_6;
|
end CASE_6;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
end;
|
end;
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
declare
|
declare
|
type Arr is array (1..1) of C460010_1.Array_Static_Integer_Constraint;
|
type Arr is array (1..1) of C460010_1.Array_Static_Integer_Constraint;
|
function Equals is new Generic_Equality (Arr);
|
function Equals is new Generic_Equality (Arr);
|
Target : Arr;
|
Target : Arr;
|
begin
|
begin
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
CASE_7:
|
CASE_7:
|
begin
|
begin
|
Target := (1 => (1 => True, 2 => True, 3 => False)); -- Named.
|
Target := (1 => (1 => True, 2 => True, 3 => False)); -- Named.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 7");
|
Report.Failed ("Constraint_Error raised: Case 7");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 7");
|
Report.Failed ("Unexpected exception raised: Case 7");
|
end CASE_7;
|
end CASE_7;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
|
|
CASE_8:
|
CASE_8:
|
begin
|
begin
|
Target := (1 => ((False, False, True))); -- Positional.
|
Target := (1 => ((False, False, True))); -- Positional.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 8");
|
Report.Failed ("Constraint_Error raised: Case 8");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 8");
|
Report.Failed ("Unexpected exception raised: Case 8");
|
end CASE_8;
|
end CASE_8;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
end;
|
end;
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
declare
|
declare
|
type Arr is array (1..1) of C460010_1.Array_Nonstatic_Integer_Constraint;
|
type Arr is array (1..1) of C460010_1.Array_Nonstatic_Integer_Constraint;
|
function Equals is new Generic_Equality (Arr);
|
function Equals is new Generic_Equality (Arr);
|
Target : Arr;
|
Target : Arr;
|
begin
|
begin
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
CASE_9:
|
CASE_9:
|
begin
|
begin
|
Target := (1 => (1 => True, 2 => True, 3 => False)); -- Named.
|
Target := (1 => (1 => True, 2 => True, 3 => False)); -- Named.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 9");
|
Report.Failed ("Constraint_Error raised: Case 9");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 9");
|
Report.Failed ("Unexpected exception raised: Case 9");
|
end CASE_9;
|
end CASE_9;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
|
|
CASE_10:
|
CASE_10:
|
begin
|
begin
|
Target := (1 => (False, False, True)); -- Positional.
|
Target := (1 => (False, False, True)); -- Positional.
|
|
|
if not Equals (Target, Target) then
|
if not Equals (Target, Target) then
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
Report.Failed ("Avoid optimization"); -- Never executed.
|
end if;
|
end if;
|
exception
|
exception
|
when Constraint_Error =>
|
when Constraint_Error =>
|
Report.Failed ("Constraint_Error raised: Case 10");
|
Report.Failed ("Constraint_Error raised: Case 10");
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised: Case 10");
|
Report.Failed ("Unexpected exception raised: Case 10");
|
end CASE_10;
|
end CASE_10;
|
|
|
---=---=---=---=---=---=---
|
---=---=---=---=---=---=---
|
end;
|
end;
|
|
|
|
|
---=---=---=---=---=---=---=---=---=---=---
|
---=---=---=---=---=---=---=---=---=---=---
|
|
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end C460010;
|
end C460010;
|
|
|