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!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Default_Storage_Pool Date: Wed, 21 Feb 2018 19:13:58 -0600 Organization: JSA Research & Innovation Message-ID: References: <74cfbf22-7082-4a43-aef9-6a55a049fe61@googlegroups.com> Injection-Date: Thu, 22 Feb 2018 01:14:01 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="21858"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:50533 Date: 2018-02-21T19:13:58-06:00 List-Id: Default_Storage_Pool only has an effect when an access type is declared (not when it is used). Thus the allocators for the component of type T should use Pool_1 regardless of what the Default_Storage_Pool is when the allocator is written. But I'd expect the local anonymous access allocator to use Pool_2. I don't see any reason to use some other pool in this case - 13.11.3(6-6.3/4) is pretty clear about this, and the rules specifically were designed so that it would apply to anonymous access types. Thus, this appears to be a bug, but I also fail to see any use for it (the anonymous access type having to disappear long before anyone can used the return value), so I would probably not give it much priority if it was reported to me. (Of course, a fuller example could cause me to change my mind on that.) Randy. wrote in message news:74cfbf22-7082-4a43-aef9-6a55a049fe61@googlegroups.com... Can anyone offer insight into what exactly should happen when Default_Storage_Pool is explicitly set within an extended return statement to a pool within the return object? In particular, consider these shenanigans: package O is pool_1 : My_Fancy_Pool pragma Default_Storage_Pool(pool_1); type T is limited record pool_2 : My_Fancy_Pool p1 : access Integer; end record; function F return T; end O; package body O is function F return T is begin return Result : T do declare pragma Default_Storage_Pool(Result.pool_2); -- legal? p2 : access Integer; begin p2 := new integer'(42); Result.p1 := new integer'(43); end; end return; end F; end O; GNAT happily accepts this, but based on print lines, it allocates Result.p1 from pool_1 and p2 from some unspecified default pool (i.e. neither pool_1 or pool_2). I wasn't sure what I was expecting; I assumed an error message, but failing that, both to go into result.pool_2, and was surprised to get neither. Any clarifications are appreciated. -sb