Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Oct 2012 16:23:59 -0400
From:      Eitan Adler <eadler@freebsd.org>
To:        Andrey Chernov <ache@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, theraven@freebsd.org
Subject:   Re: svn commit: r241373 - head/lib/libc/stdlib
Message-ID:  <CAF6rxg=azW682hF3mUw4rh8o7dUiycc_A9FLqmumxa0SGj9EYA@mail.gmail.com>
In-Reply-To: <50746BF8.5010307@freebsd.org>
References:  <201210091425.q99EPFS6020787@svn.freebsd.org> <507451DE.9060909@freebsd.org> <CAF6rxgkDbyrCHfY-5eMjJ%2B7nP9ZCnXsjLgEBB1Q_p=QJ3tCkfg@mail.gmail.com> <50746BF8.5010307@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9 October 2012 14:24, Andrey Chernov <ache@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@radar ~ ]%gcc46 -Wall -Wextra -ansi -pedantic a.c
[8089 eitan@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxg=azW682hF3mUw4rh8o7dUiycc_A9FLqmumxa0SGj9EYA>