From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9c0aeffddd5a8549 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-20 00:06:15 PST Path: pad-thai.cam.ov.com!bloom-beacon.mit.edu!news.media.mit.edu!grapevine.lcs.mit.edu!uhog.mit.edu!news.mathworks.com!news.duke.edu!eff!blanket.mitre.org!linus.mitre.org!spectre!eachus From: eachus@spectre.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: Need help with DEC Ada Date: 19 Jan 1995 19:38:48 GMT Organization: The Mitre Corp., Bedford, MA. Message-ID: References: <19950117.160119.606@vnet.ibm.com> NNTP-Posting-Host: spectre.mitre.org In-reply-to: pdennis@vnet.ibm.com's message of Tue, 17 Jan 1995 21:01:19 GMT Date: 1995-01-19T19:38:48+00:00 List-Id: In article <19950117.160119.606@vnet.ibm.com> pdennis@vnet.ibm.com (Phil Dennis) writes: > While I'm at it, I also had to change line 5 of the source code > so that the upper bound of the range was integer_32'last, rather > than (2**31) - 1. That is because the latter expression also > generated a warning about a CONSTRAINT_ERROR. Your new form is correct and protable. The old version runs into a particularly nasty effect of the Ada type model. (The expression works for the type declaration, because those bounds can be of any integer type. But here the bounds must be of the parent type, therefore the expression is evaluated using integer_32 arithmetic.) > 7 type raw_memory_t is array(natural_32) of bit; > .......1 > Info: (1) CONSTRAINT_ERROR will be raised here [LRM 11 > 1(5)] I count this as a bug, but I remember someone from DEC arguing otherwise. Storage_Error here would not be surprising, but I think what DEC is doing is evaluating the bounds of an unpacked array. When they reach the pramga pack, it is too late to go back. (On the other hand, you might want to try a range 0..integer_32'last. That might make the size calculation more successful. The current range includes an odd number of bits.) > 8 pragma pack(raw_memory_t); > 9 type raw_memory_ptr_t is access raw_memory_t; > .......1 > Info: (1) CONSTRAINT_ERROR will be raised here [LRM 11 > 1(5)] This is totally bogus! It is perfectly legitimate to have an access type where the collection can never be populated, and no object of the type is ever created. The access type need not point to a bit, in this case it designates an array type, so there should be no magic packing of pointers involved. -- Robert I. Eachus with Standard_Disclaimer; use Standard_Disclaimer; function Message (Text: in Clever_Ideas) return Better_Ideas is...