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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d43feef35662cdd7 X-Google-Attributes: gid103376,public From: Joel VanLaven Subject: Re: deallocating class-wide objects Date: 1998/07/07 Message-ID: <35a235e3.0@news4.his.com>#1/1 X-Deja-AN: 369241672 Sender: Joel VanLaven References: Organization: OC Systems Newsgroups: comp.lang.ada Date: 1998-07-07T00:00:00+00:00 List-Id: Stephen Leake wrote: : When I run the code below (compiled with GNAT 3.10p, Windows NT 4.0), : I get the following output (the Test_Storage_Pools package just adds : debug statments to 'new' and 'free') : : ./test_allocate.exe : allocating 12 from Puppet_Storage_Pool : deallocating 4 from Puppet_Storage_Pool : allocating 8 from Puppet_Storage_Pool : deallocating 4 from Puppet_Storage_Pool : allocating 12 from Muppet_Storage_Pool : deallocating 12 from Muppet_Storage_Pool : The first two cases are wrong; it should deallocate the same amount it : allocates. It appears that GNAT is deallocating just enough for the : root type, rather than for the derived type. The third case : deallocates the derived type directly, and works as expected. : I can't bring myself to believe that GNAT has a bug this : basic at this stage in the game. On the other hand, ObjectAda won't : even compile this code (bug report in the works). Can anyone confirm : that GNAT is wrong, or am I doing something erroneous? : -- Stephe. Well, I haven't spent the time to look at your code much, but I did compile it with PowerAda (our compiler :) and it behaved as you thought it should (deallocating the same amount as it allocated). While annecdotal evidence isn't a proof it does indicate to me that you are correct and GNAT is in error. Note that our compiler is on a PowerPc running AIX but I don't think that has any bearing on your test case. -- Joel VanLaven -- OC Systems