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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,13f10cac2d21b84f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-26 10:49:23 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!out.nntp.be!propagator2-SanJose!propagator-SanJose!in.nntp.be!easynews!cyclone.swbell.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3CC992D6.A87A3443@raytheon.com> From: Mark Johnson X-Mailer: Mozilla 4.76 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is this a GNAT bug??? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 26 Apr 2002 12:48:06 -0500 NNTP-Posting-Host: 192.27.48.39 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 1019843362 192.27.48.39 (Fri, 26 Apr 2002 12:49:22 CDT) NNTP-Posting-Date: Fri, 26 Apr 2002 12:49:22 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:23147 Date: 2002-04-26T12:48:06-05:00 List-Id: Robert Quinn wrote: > [snip - code for 64 bit packed array & record ] > ** NOW just replace 64 with 65 (and 63 with 64 on range) and Voila', > you get the error: > "size of ARRAY_OF_65_BITS too small, minimum allowed is 72" > [snip - same code w/ 65 bits...] > So why can't I pack a bit array of 65 bits or more bits? Anyone have > any comments? You can pack them, but you cannot expect them to take only 65 bits. I can't seem to find the specific ARM clause that applies; the closest I found is 13.3(43) which states... A Size clause should be supported for an object if the specified Size is at least as large as its subtype 'Size, and corresponds to a size in storage elements that is a multiple of the object's Alignment (if the Alignment is nonzero). I'm kind of surprised not to find similar text when the ARM defines 'Size for a subtype. The Alignment of Array_Of_65_Bits_Type is most likely 1, a storage element is most likely 8 bits, so rounding up the Size to 72 can be required by the compiler. I don't know if this was implemented in 3.13p, but try adding -gnatR to the command line. If implemented, the compiler will print out the representation information for the arrays and records. The output I get from 3.15a is that Array_of_65_Bits_Type'Size is 72 and 'Alignment is 1. Check the GNAT user's guide for more information. You may also find that pragma Pack does not do as much in GNAT as you might hope. I have a long running argument w/ Robert Dewar on a relatively recent change in GNAT 3.15 that caused some of our packed arrays to grow in size. He points to text in 13.2 which states "the implementation may, but need not, reorder components or cross aligned word boundaries to improve packing". --Mark