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!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Possible GNAT bug, but wanted to see if it was a violtion of the RM Date: Sun, 25 Feb 2018 11:55:11 +0000 Organization: A noiseless patient Spider Message-ID: References: <906cd418-adff-4eeb-9da5-7c6f7c777ff8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="6f50c8c785b8831942dc44802c5b5720"; logging-data="21256"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+escOM/QzCIyikJm630t8N1uxLAt7LG8U=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (darwin) Cancel-Lock: sha1:D6d2VMdA9Vrb6nbelCZDlHhVlOg= sha1:dfO8/wkjxc50DoBYS39uYdXlnB0= Xref: reader02.eternal-september.org comp.lang.ada:50629 Date: 2018-02-25T11:55:11+00:00 List-Id: Jere writes: > Thanks! That confirms my initial suspicion of it being related to > tamper checks, but I can't figure out how. I looked through the GNAT > code and saw how they locked it in the Constant_Reference function, > but I can't for the life of me figure out how calling it using: > > Package.Operation(Object,Params).Discriminant > > would work differently than > > Object.Operation(Params).Discriminant > > for that function call. Compiling with -gnatG (to list an Ada-like representation of what the compiler has transformed your code into before it starts optimisation/code generation) shows that the Package.Operation version includes some finalization in Operation that's missing in the Object.Operation version. Looks very like a bug!