This is the mail archive of the gcc-patches@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: [gimple] assignments to volatile


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


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