Re: Are arrays guaranteed to be affected by a "memory" clobber?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/15/2015 11:19 AM, Segher Boessenkool wrote:
On Mon, Jun 15, 2015 at 11:02:44AM -0600, Martin Sebor wrote:
Let me clarify one important property of the GCC implementation.
In contrast to a strict reading of the C standard, GCC doesn't
require an object to be declared volatile in order to guarantee
that volatile semantics are applied to accesses to it. What
matters is the volatility of the lvalue used to perform the
access.

This isn't documented behaviour though; see PR33053.

Thanks for the pointer!

This subject came up in WG14 recently. While the official C text
doesn't require this behavior, the original intent reflected in
the C99 Rationale, is that it work. (Without it the example that
motivated the introduction of volatile into C wouldn't work.)

Since this is widely relied on, documented in popular articles
on C programming, and required by C++, I plan to submit a proposal
for the October meeting to bring the C standard into alignment with
the C99 Rationale and with C++ which has always required it.

Until the proposal is accepted (assuming it is accepted) it seems
that documenting this guarantee in the GCC manual would give users
a peace of mind and sanction the kernel uses.

Martin




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux