From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19680 invoked by alias); 8 May 2003 12:30:54 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 19637 invoked from network); 8 May 2003 12:30:53 -0000 Received: from unknown (HELO uniton.integrable-solutions.net) (62.212.99.186) by sources.redhat.com with SMTP; 8 May 2003 12:30:53 -0000 Received: from uniton.integrable-solutions.net (localhost [127.0.0.1]) by uniton.integrable-solutions.net (8.12.3/8.12.3/SuSE Linux 0.6) with ESMTP id h48CTwYq022990; Thu, 8 May 2003 14:29:58 +0200 Received: (from gdr@localhost) by uniton.integrable-solutions.net (8.12.3/8.12.3/Submit) id h48CTvq9022989; Thu, 8 May 2003 14:29:57 +0200 X-Authentication-Warning: uniton.integrable-solutions.net: gdr set sender to gdr@integrable-solutions.net using -f To: Fergus Henderson Cc: Michael Eager , Richard Henderson , Geoff Keating , jbuck@synopsys.com, espie@quatramaran.ens.fr, gcc@gcc.gnu.org Subject: Re: volatile [was: GCC warnings for unused global variables] References: <200305020347.h423l3F12721@desire.geoffk.org> <20030502041132.GU31208@redhat.com> <20030502090414.GA26392@ceres.cs.mu.oz.au> <3EB3F33A.60B1BBC@eagercon.com> <20030503190000.GA14443@ceres.cs.mu.oz.au> <3EB4C299.3FE214BA@eagercon.com> <20030504111911.GA5416@ceres.cs.mu.oz.au> <20030504121953.GA7811@ceres.cs.mu.oz.au> <20030504142651.GA17712@ceres.cs.mu.oz.au> From: Gabriel Dos Reis In-Reply-To: <20030504142651.GA17712@ceres.cs.mu.oz.au> Organization: Integrable Solutions Date: Thu, 08 May 2003 12:30:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-05/txt/msg00765.txt.bz2 Fergus Henderson writes: | On 04-May-2003, Gabriel Dos Reis wrote: | > Fergus Henderson writes: | > | I do not agree that the text which you quoted permitted such optimization. | > | > Still, it says so in black on white. | | The C standard text which you quoted doesn't say that the optimization | is permitted unconditionally. ^^^^^^^^^^^^^^^ Which is not my claim. | It only says that the optimization is | permitted only "if [the implementation] can deduce that [the expression's] | value is not used and that no needed side effects are produced". In what is that different from # Why? the last part of the paragraph quoted above does specifically # permit that optimization where applicable. quoted from http://gcc.gnu.org/ml/gcc/2003-05/msg00145.html ? | In the | case of volatile variables, this condition is always false, No, because the standard does specifically add INCLUDING ANY CAUSED BY CALLING A FUNCTION OR ACCESSING A VOLATILE OBJECT | because the | definition of volatile means that the implementation can never know if | a side effect is "needed". The definition of "volatile" does not say that the implementation can never know if a side effect is needed. what you've discovered is just another facet of the ill-defined notion of "volatile". -- Gaby