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: Robert Dewar Subject: Re: Unreferenced lock variables Date: 1999/04/12 Message-ID: <7esrmv$k1n$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 465448552 References: <7ero31$n46$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x6.dejanews.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Apr 12 13:16:22 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-04-12T00:00:00+00:00 List-Id: 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. With regard to initialization and finalization, the ARG just agreed (unwisely if you ask me!) to allow a compiler to optimize away initialization and finalization for an otherwise unreferenced variable. GNAT does not take advantage of this, but it means that to be compeltely portable, you need to put in a dummy reference to the variable. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own