This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gimple] assignments to volatile
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: Mike Stump <mikestump at comcast dot net>, Michael Matz <matz at suse dot de>, Richard Guenther <richard dot guenther at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Aug 2010 08:30:12 -0700
- Subject: Re: [gimple] assignments to volatile
- References: <4C1F5380.1090107@codesourcery.com> <AANLkTimzBtuWYWnzMkmDyM6Y490EIwQJxaDI_higMvJs@mail.gmail.com> <Pine.LNX.4.64.1006211517460.11284@wotan.suse.de> <4C20D40B.30904@codesourcery.com> <Pine.LNX.4.64.1006221721590.18619@wotan.suse.de> <4C20D891.5030506@codesourcery.com> <4C21E361.1040900@codesourcery.com> <4C220762.2060703@codesourcery.com> <025B27D1-E620-4BA2-A113-FD28747E2762@comcast.net> <4C22F307.6010403@codesourcery.com> <4936DDA8-4C55-4CF8-8CA7-D8B4435863BF@comcast.net> <4C236C7A.40303@codesourcery.com> <97293849-2D1F-4DE5-9B35-199E26005768@comcast.net> <4C2451CA.2020906@codesourcery.com> <E1CA7E86-EEE4-4EB7-8CAF-0FA59DD694DB@comcast.net> <4C2852F4.6070809@codesourcery.com> <CAC3E597-C092-4A46-9EEF-96589BC6794B@comcast.net> <4C319EF7.4040001@codesourcery.com> <3721950A-1FF1-441A-A22E-D19507FC36FB@comcast.net> <4C36CE16.2030200@codesourcery.com> <4C4013FB.8090203@codesourcery.com> <4C4078C6.1020104@codesourcery.com> <4C651330.5000102@codesourcery.com>
Nathan Sidwell wrote:
>> So, my first preference would be to adopt the EDG semantics, and my
>> second preference would be to adopt the VC++/trunk semantics. My
>> preference for the EDG semantics is somewhat offset to some extent by
>> the fact that our current semantics are "more like" GCC's past behavior,
>> i.e., they are more backward-compatible.
>
> There seems to have been no responses to your suggestion. Can we move
> forward to reviewing the updated patch itself?
Your patch implements *almost* the EDG semantics. As I understand it,
you've implemented the EDG semantics, with one exception: that in C++,
vobj5 in this table:
http://gcc.gnu.org/wiki/VolatileAccessComparison
is reread. In that way, you're consistent between C and C++, whereas
EDG, in C++, avoids the read.
I think it's better to be consistent between C and C++. Real users
expect to be able to move code back and forth between the languages, and
this is a very subtle difference.
> The patch is http://gcc.gnu.org/ml/gcc-patches/2010-06/msg02145.html
> and Richard indicated he'd review it once semantics were agreed.
I think the patch is ready for review. If Richard isn't able to review
it soon, I will do so.
I do think that we should have a section in our manual that documents
these semantics. There are always corner cases, but I think that
something like the following is a reasonable start:
==
GCC never generates a read from a `volatile' object merely because that
object is being modified, unless the object is a bitfield. (If the
object is a bitfield, the compiler may have to read the current value of
the bitfield, modify it, and store the new value.)
Concretely, none of the following statements result in a read of `vobj':
int obj;
volatile int vobj;
vobj = 0;
obj = vobj = 0;
obj ? vobj = 0 : vobj = 1;
==
Would you please find a place to put that (or some modified form
thereof) in the manual? I can review that in parallel with Richard
reviewing the core patch.
Thanks,
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713