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,8247c32bb1260c74 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-22 14:45:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Q re pack & aliased Date: 22 Apr 2003 17:45:09 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1051047909 8824 199.172.62.241 (22 Apr 2003 21:45:09 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 22 Apr 2003 21:45:09 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:36376 Date: 2003-04-22T17:45:09-04:00 List-Id: Stephen Leake writes: > tmoran@acm.org writes: > > > I have pre-Gnat 3.15p programs that ran with 24 bit pixels, so this > > is apparently a new problem. Would someone with a newer Gnat please > > try the program below? > > stephe@anarres$ gnatmake -v testpack.adb > > GNATMAKE 3.16a (20030120) Copyright 1995-2002 Free Software Foundation, Inc. > "testpack.ali" being checked ... > -> "testpack.ali" missing. > gcc -c testpack.adb > testpack.adb:6:03: warning: pragma "pack" ignored, cannot pack aliased components > testpack.adb:7:03: warning: "x" is never assigned a value > End of compilation > > Sorry. Apparently ACT felt the need to improve efficiency somewhere. > There may be a compiler switch to get back the old behavior. You could > try reporting it to report@gnat.com as a regression. I don't have any > older gnat versions handy. Seems like the old and new behavior are the same. In both versions, the compiler refuses to pack aliased 24-bit components. Or did I misunderstand the ealier posting? Anyway, I think what's going on here is that all aliased objects of a given subtype *must* be represented the same way. That's because when you have a pointer in your hands, the compiler doesn't know what it points to. The code generated for X.all has to fetch a 24-bit quantity, not knowing whether it's an array component, or whether the array is packed. The most efficient way to fetch 24 bits on this machine is to make sure the thing is 32-bit aligned, with zeros or sign-extension in the extra 8 bits. If you insist that the array-of-aliased be tightly packed, then every X.all would have to be less efficient. It's fine if references to components of packed arrays are less efficient. That's The whole point of packing -- to allow slowness of array indexing in return for better speed of copying or comparing the whole array and so forth. But it's not fine to make X.all slow even when X points to a component of an unpacked array, or into the heap. - Bob