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


Mike Stump wrote:

> I'd like to understand how you interpret the standard.

I simply think it does not say.  I don't think it says make a copy.  I
don't think it says don't make a copy.  I understand how you are reading
it, but I think you're finding meaning where none is necessarily
present.  I'll be persuaded if you show me a consensus of people on the
standards reflector, but you didn't want to ask on the reflector.

If it is unspecified, I'd rather not do the read.  I don't argue the
standard mandates not doing the read, but I feel that it's better
behavior.  I think it's odd to do a read from "y" in "x = y = z", but I
think it's *very* odd to do a read from "y" in the case of "x ? y = z :
...", which is what Nathan says we presently do.

> Other compilers might differ on the re-read.  Even if they did, I'd
> still object to changing gcc to match them.  I'd rather talk with
> their implementors and figure out if they think they conform to the
> standard or not, and if not, why?  Could be just a simple bug in
> their compiler that they would fix.

I don't find that likely.  Changing this behavior will change the
meaning of existing programs in mysterious ways.  I doubt you'll find
compiler implementors eager to do that.  But, we can't know until we
test the compilers.  Maybe they all agree with you.

Backwards compatibility is also the best reason not to change GCC; even
if the standard unambiguously mandated that we change, it might not make
sense to change, since it might break code that's worked with GCC for a
long time.

But, that doesn't resolve the constant vs. non-constant question.
That's an inconsistency so weird and horrid that I think we have to
change either the constant case or the non-constant case.  If we don't
make those cases consistent, we'll find that optimization levels affect
whether a volatile location is read and that's very bad indeed.  So, I
think that GCC is going to have to change it's behavior in one or the
other of these cases.

Right now you're asserting that the standard mandates a particular
behavior, but you seem unwilling to back that up by getting a consensus
on the reflector, and you're saying that existing practice by other
compilers won't change your opinion.  That seems a pretty rigid
position.  I'd be a lot more persuaded if you helped to establish either
a consensus on the standards reflector or demonstrated a consensus of
other compilers.

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