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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Deallocating an object twice Date: Sun, 27 Jul 2014 09:31:39 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="f008dfb2a20cab2735f9b6a28e892fd7"; logging-data="9985"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iJ1LghtNQxZWA/EfGk4vBgnwIAv4aN8k=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:zpFsfzHF4APJBON+RHPX4CqrhL0= sha1:O8jDLLkzbyw1YaMJYwn072sxiJU= Xref: news.eternal-september.org comp.lang.ada:21276 Date: 2014-07-27T09:31:39+01:00 List-Id: Victor Porton writes: > If I understand correctly, it is an undefined behavior (or is it called > unbounded error?) if a pool access is deallocated twice with > Unchecked_Deallocation. > > I think it should be a Program_Error (if checks are on). > > Why was not this done even in Ada2012 (not speaking about older Ada)? > > It's bad. > > Or is it done and I just miss it? If done at all, this check would be at a low level. AdaCore offer a Debug Pool facility[1]. Of course, this wouldn't detect a C program using free() on data allocated in Ada; you'd have to go lower, perhaps using a tool like valgrind[2]. [1] https://gcc.gnu.org/onlinedocs/gnat_ugn_unw/The-GNAT-Debug-Pool-Facility.html [2] http://valgrind.org