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,7f1e0b399cd01cb0 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Unreferenced lock variables Date: 1999/04/12 Message-ID: #1/1 X-Deja-AN: 466016311 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: <7ero31$n46$1@nnrp1.dejanews.com> <7esrmv$k1n$1@nnrp1.dejanews.com> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 924034735 nnrp-12:14277 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada Date: 1999-04-12T00:00:00+00:00 List-Id: Robert Dewar writes: > In article , > Simon Wright wrote: > > Because I'm concerned that aggressive optimization (-O3) > > will eliminate the lock variable altogether. > > > > The last time this happened was > > > > Dummy : Foo := Some_Function_With_Side_Effects; > > > > and -O3 ended up without the side effects. > > Well that would have course have been a significant bug, > and we have never seen any such bug in -O2 mode (-O3 > is irrelevant here), nor had any such problem reported > that I can remember. The backend may well remove the > variable itself, but cannot remove the call. In what way irrelevant? Am I supposed not to use -O3? or do you just mean that there is no distinction here between 2 and 3 (I only have the 3.10 version of the secret manual here, it indicates that -O3 only adds automatic inlining). I certainly saw this with GNAT 3.11p, the compiler warned that the variable was unused, when I compiled -O3 there was a misbehaviour in my code explainable as above, change the code to achieve the side-effect via a procedure call in the body and the misbehaviour goes away. I can try to reconstitute the problem and report it (if it is indeed a bug to optimize away the initialization of an unused variable? it struck me at the time that it was much more my fault!)