This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Volatiles and speculative memory access reordering...


On Thu, Nov 27, 2003 at 11:16:57PM -0000, aspiesrule@mcleodusa.net wrote:
> On modern CPU's such as Intel's Pentium 4 and Itanium 2, the CPU may reorder 
> accesses to volatiles across sequence points if a serializing insn is not 
> inserted at the sequence point.

I don't believe you.  Intel is very good about maintaining accesses in
order from the point of view of the program.  If you think "volatile"
means atomic, you're wrong.

If you're talking about multiple cpus, then yes you have to insert
serializing insns.  But this is usually the lock-prefixed atomic
memory update instruction.  See any of a dozen thread libraries for
examples of how to do this.


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]