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,43127f177a55dc41 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.42.246.3 with SMTP id lw3mr13077833icb.0.1320362071746; Thu, 03 Nov 2011 16:14:31 -0700 (PDT) Path: p6ni68038pbn.0!nntp.google.com!news2.google.com!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: limited allocated classwide types Date: Thu, 03 Nov 2011 23:14:30 +0000 Organization: A noiseless patient Spider Message-ID: References: <0ed43f83-40e7-46d3-8cc4-e1c41f500d28@c1g2000vbw.googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="26930"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18KkdDTV0YPpEe5mLx/PlVop8ypgkTQzsM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (darwin) Cancel-Lock: sha1:ceUa2WF5QPAV7a79tv3dB9DapoU= sha1:ZHFTXRUJCrDb78EKCKWKTmmTKWY= Xref: news2.google.com comp.lang.ada:14302 Content-Type: text/plain; charset=us-ascii Date: 2011-11-03T23:14:30+00:00 List-Id: Simon Belmont writes: > The entire sample program is at the bottom, but here is the basic > jist: > [...] > When the access type is changed to: > > type Foo_Ptr is access all I.LI'Class; > > the output crashes to some strange function that indicates it should > be impossible to ever get to (hence my confusion): > > Entered Create > Entered Initialize > Entered Extended Return > Leaving Extended Return > Starting... > Entered Finalize > > raised PROGRAM_ERROR : s-finroo.adb:42 explicit raise > [2011-11-03 17:40:27] process exited with status 1 (elapsed time: > 00.13s) I added another procedure to LI: package I is type LI is limited interface; procedure Dummy (This : LI) is abstract; procedure Doo (This : LI) is abstract; end I; and added the expected implementation, and then the output was Entered Create Entered Initialize Entered Extended Return Leaving Extended Return Starting... Entered Finalize <-------------- !!!! Ending... Entered Finalize but if I write package I is type LI is limited interface; procedure Doo (This : LI) is abstract; procedure Dummy (This : LI) is abstract; end I; I get the Program_Error as before. The reason it's possible to end up at Adjust in s-finroo.adb is that System.Finalization_Root is common to Limited_Controlled and Controlled, it's just that Limited_Controlled should of course never call it. Looks as though the compiler has managed to mangle the dispatch table, which is clearly a compiler error. GCC 4.6, with your original code, outputs Entered Create Entered Initialize Entered Extended Return Leaving Extended Return Starting... Entered Initialize Ending... which is differently wrong, and GCC 4.7 (into which AdaCore have been rolling changes to finalization like those in GNAT GPL 2011) behaves like GNAT GPL 2011.