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:

> Is there consensus on what the semantics should be?
> 
> Any suggestions as to how to move forward?

In the abstract, I think the EDG semantics make the most sense.   I
think the VC++ semantics are plausible, but extreme.  I think the
various in-between states that GCC has adopted over the years are just
woefully inconsistent.

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.

One of the reasons I do not like the VC++/trunk semantics are that using
assert-like macros will change behavior.  For example:

  #define check(X, Y) (X) ? (Y) : abort()
  check (condition, vobj = 3);

I think it's quite surprising that this generates a *read* from vobj,
even though:

  vobj = 3;

does not.

I would prefer not to insert reads except where absolutely required
because (a) they may change the state of hardware in surprising ways,
and (b) they cost cycles.  In short, by requiring rereads, we're setting
GCC up to underperform competing compilers on embedded systems.

-- 
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]