mailing list of musl libc
 help / color / mirror / code / Atom feed
* Access through cast to volatile
@ 2015-05-17 18:21 Alexander Monakov
  2015-05-17 19:35 ` Jens Gustedt
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Monakov @ 2015-05-17 18:21 UTC (permalink / raw)
  To: musl

On Sun, 17 May 2015, Jens Gustedt wrote:
> > > I only recently learned that even cast to volatile doesn't help in
> > > cases where the original object to which p points is not declared
> > > volatile. The C standard states that only volatile *declared* objects
> > > are subject to the rules of volatile. Accessing through a volatile
> > > pointer doesn't help.
> > 
> > I'm not so sure about that.
> 
> I am quite sure. We recently had a discussion on that in the
> committee, and the outcome was basically what I was stating above.

Was the Linux kernel's use of volatile cast in its ACCESS_ONCE macro
discussed?

(I realize it's offtopic, but I hope it's acceptable)

> > See this question on SO, which has two
> > conflicting and both reasonable-sounding answers:
> > 
> > http://stackoverflow.com/questions/28654418/requirements-for-behavior-of-pointer-to-volatile-pointing-to-non-volatile-object
> 
> thanks for the pointer, I didn't knew about the text in the rationale.
> 
> This could be an indication that the text as it is in the standard is
> a defect.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Access through cast to volatile
  2015-05-17 18:21 Access through cast to volatile Alexander Monakov
@ 2015-05-17 19:35 ` Jens Gustedt
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Gustedt @ 2015-05-17 19:35 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]

Am Sonntag, den 17.05.2015, 21:21 +0300 schrieb Alexander Monakov:
> On Sun, 17 May 2015, Jens Gustedt wrote:
> > > > I only recently learned that even cast to volatile doesn't help in
> > > > cases where the original object to which p points is not declared
> > > > volatile. The C standard states that only volatile *declared* objects
> > > > are subject to the rules of volatile. Accessing through a volatile
> > > > pointer doesn't help.
> > > 
> > > I'm not so sure about that.
> > 
> > I am quite sure. We recently had a discussion on that in the
> > committee, and the outcome was basically what I was stating above.
> 
> Was the Linux kernel's use of volatile cast in its ACCESS_ONCE macro
> discussed?

yes

But the Linux kernel uses stronger properties than are given by the C
standard. It is in many parts built upon assumptions about gcc and its
extensions.

> (I realize it's offtopic, but I hope it's acceptable)

I don't think it is offtopic, we have to be sure what assumptions we
want to make.

Jens


-- 
:: INRIA Nancy Grand Est ::: Camus ::::::: ICube/ICPS :::
:: ::::::::::::::: office Strasbourg : +33 368854536   ::
:: :::::::::::::::::::::: gsm France : +33 651400183   ::
:: ::::::::::::::: gsm international : +49 15737185122 ::
:: http://icube-icps.unistra.fr/index.php/Jens_Gustedt ::




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-17 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-17 18:21 Access through cast to volatile Alexander Monakov
2015-05-17 19:35 ` Jens Gustedt

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).