svn commit: r241373 - head/lib/libc/stdlib

Eitan Adler eadler at freebsd.org
Tue Oct 9 20:24:30 UTC 2012


On 9 October 2012 14:24, Andrey Chernov <ache at freebsd.org> wrote:
> I don't have ISO9899 nearby, could you directly quote mentioned
> sections, please?

Accesses to volatile object (a) produce side effects (b) have
implementation defined values.

A more careful re-reading of the relevant section leads me to believe
I may have been wrong
with this comment.  It isn't made explicit, but the C standard never
says that accesses
to uninitialized volatile is defined. On the other hand, the existence
of "const volatile" proves me wrong.
Interestingly, clang and gcc disagree on whether to warn:

[8084 eitan at radar ~ ]%gcc46 -Wall -Wextra -ansi -pedantic a.c
[8089 eitan at radar ~ ]%clang -Wall -Wextra -ansi -pedantic a.c
a.c:3:9: warning: variable 'a' is uninitialized when used here [-Wuninitialized]

I still don't like volatile though here for the other reasons
mentioned. In general, the entire piece of code should be replaced
with something that can't fail, so this is a moot point.

> Do you against 'volatile' usage at all? It seems whole
> kernel (see above) contradicts with such point of view.

Not, I never said any such thing. Volatile is designed for memory
mapped I/O and it makes sense to use for such things.
I haven't audited every use of 'volatile' though.

-- 
Eitan Adler
Source & Ports committer
X11, Bugbusting teams


More information about the svn-src-head mailing list