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,3fc1c2283df835d5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-31 10:50:13 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Limited_Controlled types as 'out' arguments Date: Thu, 31 Jul 2003 12:51:46 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <73mfiv811s5187ci5cesv12dsbf88a0rvn@4ax.com> <93nhiv8khhibv15shv21g2t3o179gf69kl@4ax.com> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:41097 Date: 2003-07-31T12:51:46-05:00 List-Id: "Lutz Donnerhacke" wrote in message news:slrnbihtb3.2j7.lutz@taranis.iks-jena.de... ... > Results in: > Initializing 134630800(0) > Initializing 134630816(1) > Setting from 134630816(1) > Setting o1 134630800(0) > Setting o2 134630800(0) > Finalizing 134630800(0) > raised PROGRAM_ERROR : t1.adb:14 > Finalizing 134630816(1) > > I'am mad? Yes. :-) Finalize routines always have to be written to work on an already finalized object. There are variety of ways for extra Finalize calls to occur even without any explicit ones. So your Finalize needs to be something like: procedure Finalize(o : in out Test) is begin if o.a /= null then Debug("Finalizing ", o.a); Free(o.a); -- else already finalized. end if; end Finalize; Otherwise, you're freeing an already freed object. This is discussed in the AARM: http://www.adaic.org/standards/95aarm/html/AA-7-6-1.html See the note at paragraph 24 and the following discussion. Randy.