This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: volatile [was: GCC warnings for unused global variables]


> X-Original-To: geoffk@foam.wonderslug.com
> Cc: Michael Eager <eager@eagercon.com>, Richard Henderson <rth@redhat.com>,
>    Geoff Keating <geoffk@geoffk.org>, jbuck@synopsys.com,
>    espie@quatramaran.ens.fr, gcc@gcc.gnu.org
> From: Alexandre Oliva <aoliva@redhat.com>
> Organization: GCC Team, Red Hat
> Date: 06 May 2003 02:34:57 -0300
> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
> X-OriginalArrivalTime: 06 May 2003 05:35:20.0749 (UTC) FILETIME=[48B4A5D0:01C31391]
> 
> On May  4, 2003, Fergus Henderson <fjh@cs.mu.OZ.AU> wrote:
> 
> >> They can be
> >> created with the initialized value, if that can be calculated at
> >> compile time (e.g., if there is no constructor).
> 
> > That is true for non-volatile variables, but only because the compiler
> > can apply the as-if rule.  As discussed earlier in this thread, the
> > as-if rule does not apply to volatile variables -- the standard prohibits
> > implementations from optimizing away accesses to volatile variables.
> 
> Except that the object only becomes volatile after it is initialized.
> Otherwise, there'd be no constructor to initialize it, since
> cv-qualifiers don't make it to the type of `this' in cdtors.

We're talking about C++ here, right?  Certainly there's no wording in
the C standard like this.

-- 
- Geoffrey Keating <geoffk@geoffk.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]