[En-Nut-Discussion] Hardware Register Access Using Volatile Pointer

Bernard Fouché bernard.fouche at kuantic.com
Tue Apr 26 17:04:40 CEST 2011

Le 26/04/2011 14:55, Harald Kipp a écrit :
> What I understood is, that volatile means for reading, that the compiler
> must reload the value each time before using it. I can't find any
> document that states, that the read is done in any case, even if the
> result is not needed.
> A few tests with GCC 4.6 showed, that the read is conserved. But is that
> a proof?

GCC documentation  (http://gcc.gnu.org/onlinedocs/gcc/Volatiles.html) says:

A scalar volatile object is read when it is accessed in a void context:

      volatile int *src =somevalue;

(see also http://gcc.gnu.org/onlinedocs/gcc/Qualifiers-implementation.html)


More information about the En-Nut-Discussion mailing list