From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 18 Nov 92 13:22:53 GMT From: cis.ohio-state.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!apl cen.apl.jhu.edu!ddsdx2.jhuapl.edu!dlc@ucbvax.Berkeley.EDU (Dave Collard x7468) Subject: Re: null arrays Message-ID: <1992Nov18.132253.17081@aplcen.apl.jhu.edu> List-Id: In jhb@dale.cts.com (John Bollenbacher) writes: >Can somebody shed some light on the symptoms of the following program. In >-------------------cut here----------------------------------------------- >procedure TEST is > subtype T is NATURAL range 0 .. 10; > type ARR is array (T range <>) of BOOLEAN; > > type A(N : T := 0) is record > DATA : ARR(1..N); > end record; > I : INTEGER; > O : A := (3, (TRUE, FALSE, TRUE)); > > N1 : constant ARR := O.DATA(1..0) & O.DATA(1..0); > N2 : constant ARR := O.DATA(1..0) & O.DATA(3..2); -- The result of concatenation of a null array and another array is -- an array with the range of the second array. Thus N1 has a range -- of 1..0 and N2 has a range of 3..2. >begin > I := N1'LENGTH; -- I = 0 > I := N2'LENGTH; -- I = 0 > O := (0, N1); -- does not raise constraint > O := (0, N2); -- raises constraint -- Given the above, this is the common sliding error. An aggregate assignment -- does not "slide" the indices to match the constraints of the array in your -- record. Since N1'First is 1, no problem. N2'First is 3 so it does -- not match 1..N. >end TEST; --Thor collard@capsrv.jhuapl.edu dlc@ddsdx2.jhuapl.edu