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-Thread: 103376,25ab365b646cef74 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!postnews.google.com!v16g2000prc.googlegroups.com!not-for-mail From: Jerry Newsgroups: comp.lang.ada Subject: Re: GNAT 4.2.3 Ubuntu reports weird compile error wrt Unchecked_Access Date: Sun, 17 Aug 2008 14:14:40 -0700 (PDT) Organization: http://groups.google.com Message-ID: <5237f306-275c-4085-971d-1b967a8f055b@v16g2000prc.googlegroups.com> References: <7053ea09-38cd-4e30-9827-a1384bafd190@p31g2000prf.googlegroups.com> <37Ppk.5180$Mh5.1917@bgtnsc04-news.ops.worldnet.att.net> NNTP-Posting-Host: 75.171.118.139 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1219007682 28817 127.0.0.1 (17 Aug 2008 21:14:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 17 Aug 2008 21:14:42 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v16g2000prc.googlegroups.com; posting-host=75.171.118.139; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US) AppleWebKit/525.18 (KHTML, like Gecko, Safari/525.20) OmniWeb/v622.1.0.104087,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1642 Date: 2008-08-17T14:14:40-07:00 List-Id: On Aug 17, 12:47=A0pm, a...@anon.org (anon) wrote: > Addition: > > The problem is that local data is stored on the primary stack and if an e= rror > is encounter the exception handlers could remove the local data off the s= tack, > creating a 'dangling references.'. Which would makes the pointer (Access > variable) invalid or unsafe. > > So, you must use the "Unchecked_Access" for local data and the programmer > is responsible for catching any exceptions or other conditions that might > cause a 'dangling reference.' > > Also, because of the specs refering to "Access" and "Unchecked_Access" > in both Ada_95 and Ada_2005 is basically unchanged you can use > "Unchecked_Access" instead of "Access" but be warned you must insure > the code is safe. > > And any GNAT that does not support this type of safety should be concerne= d > as corrupt and unusable. > > PS. =A0As for Ada-83, the answer is no! =A0"Unchecked_Access" was added > during the creation of Ada-95. > > In <37Ppk.5180$Mh5.1...@bgtnsc04-news.ops.worldnet.att.net>, a...@anon.or= g (anon) writes: > Thanks for clarifying the availability of 'Unchecked_Access across language versions. I have a fair grasp of the accessibility rules for access variables (although I struggle with it sometimes). However, my original post was not a question of how to use them per se, but about an apparent compiler error on a particular version of GNAT on Ubuntu. FWIW, I moved the declaration of Temp_C_String to the same place where its type is declared and am now able to use 'Access, as in Temp_C_String'Access. The developer who originally reported the problem has responded to me that this has allowed the compilation to progress normally. Given that, I probably won't pursue this too much farther, but nevertheless, there might be some interest by others in discovering if this possible compiler mistake is important enough to chase down and fix. Jerry