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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,be90c35154ae91c1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-04 12:19:46 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.nuthinbutnews.com!feed-ev1!propagator-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc01.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <21b0043b.0204040925.4654c421@posting.google.com> Subject: Re: error in index constraints with initial value X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Message-ID: Date: Thu, 04 Apr 2002 20:19:37 GMT NNTP-Posting-Host: 141.157.176.41 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc01.gnilink.net 1017951577 141.157.176.41 (Thu, 04 Apr 2002 15:19:37 EST) NNTP-Posting-Date: Thu, 04 Apr 2002 15:19:37 EST Xref: archiver1.google.com comp.lang.ada:22114 Date: 2002-04-04T20:19:37+00:00 List-Id: The problem with your definition of XXXX_LINE is that you do not constrain the record variant LENGTH. LENGTH will default to 5, but since it is not constrained, XXXX_LINE can be assigned a VAR_LINE value of any length, even LENGTH => Integer'Last! Of course, this requires more space than is possible, resulting in the blow-up. There are a couple of ways to handle this properly. If XXXX_LINE really needs to hold VAR_LINE records of widely varying and arbitrarily long lengths, you should declare XXXX_LINE as an access value and allocate these VAR_LINE records from the heap. Another possible solution is available is we can assume that there is a reasonable upper limit on the length of a VAR_LINE. We can then use a subtype to limit the value of LENGTH, so that VAR_LINE has a reasonable maximum size, e.g., subtype Var_Line_Len is Integer range 0 .. 1023; type VAR_LINE( LENGTH : Var_Line_Len := 5 ) is record IMM:STRING(1..LENGTH); end record; With this declaration, VAR_LINE will never have a length greater than Var_Line_Len'Last. With this change, your program should compile.