Re: Can I force a word read-modify-write instread of a byte write?

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

 



"Phil Endecott" <spam_from_gcc_help@xxxxxxxxxxxx> writes:

> I know that in some circumstances gcc will generate read-modify-write
> sequences to access memory locations, for example if I have a bitfield
> struct.  Is there a way in which I can tell it to only do (32-bit)
> word writes to a region of memory, and to do read-modify-write
> sequences instead of byte writes, even though the processor does have
> byte write instructions?

Sure, this is what the volatile qualifier is for.  If you always
access the memory through volatile qualified pointers, the compiler
will always access the memory precisely as you write in the program.

This is one of the few cases where volatile is actually useful.

Ian

[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