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 Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news.glorb.com!news2.glorb.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: Issue with GNAT GPL 2009 and GtkAda Followup-To: comp.lang.ada Date: Fri, 26 Jun 2009 10:39:45 +0200 Message-ID: <7ajfrgF1vdsnlU1@mid.individual.net> References: <4A414EBB.8060204@free.fr> <1avd65rn49abv$.krcxo2gdzb16$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Trace: individual.net tU13S9uLXXIBYTyTO5nsiQWLP3fr9lGE0SnGWEOuu9maxtEk8= Cancel-Lock: sha1:1B24pLHiKo9sGZzP1xI9QhQ9BGU= User-Agent: KNode/4.3.0 pre Xref: g2news2.google.com comp.lang.ada:6628 Date: 2009-06-26T10:39:45+02:00 List-Id: Dmitry A. Kazakov wrote: > On Thu, 25 Jun 2009 05:06:08 -0400, Stephen Leake wrote: > >> Another thought: whenever I have trouble with anonymous access types, >> I replace them with the corresponding named access type, and the >> problem goes away. That may indicate a conmpiler bug, but I've always >> had to much to do to find out. > > Yes, but that is not necessarily a compiler bug. It is quite simple to > create a serious problem to oneself: > > declare > Ptr : access T := new T; > begin > ... > External_Ptr := Ptr.all'Uchecked_Access; -- Copy the pointer > ... > end; -- Now External_Ptr is dangling, because the object is freed. If I understand correctly, this is because the type of Ptr goes out of scope? I strongly suspect that Gnat does not behave this way, but I should test it.