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: controlled constant_reference type? Date: Wed, 14 Mar 2018 17:46:40 -0500 Organization: JSA Research & Innovation Message-ID: References: <977b6908-e955-45de-8315-2902f1a1f1c8@googlegroups.com> Injection-Date: Wed, 14 Mar 2018 22:46:40 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="14862"; 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:50977 Date: 2018-03-14T17:46:40-05:00 List-Id: >"Stephen Leake" wrote in message >news:977b6908-e955-45de-8315-2902f1a1f1c8@googlegroups.com... >I'm trying to create a protected vector container, that automatically >provides task-safe access. > >I'm having trouble with GNAT GPL 2017 not finalizing a read lock object, >and I'm wondering if this is a compiler error. It's hard to say without doing a complete debug of your code, and I don't have time or energy to do that. An object of a limited controlled type has pretty canonical semantics, and there really aren't many optimizations that can be done (mostly just omitting temporary objects). OTOH, an object of a nonlimited controlled type has rather squishy semantics, and there are many allowable optimizations. However, the basic rule of (aggregates + Initialize calls + Adjust calls) = Finalize calls is supposed to be true regardless of what optimizations are made or not made. Still, it's a common programming error to forget that aggregates don't call Initialize (the assumption is that they completely initialize the object) or to forget to take Adjust into account when assignments (like function returns) are involved. So I'd check those first, and if those are properly accounted for, then it's most likely a compiler bug. Randy.