On Mon, Jun 16, 2008 at 6:14 PM, Carlos O'Donell <carlos@xxxxxxxxxxxxxxxx> wrote: > Given: > mb() > __ldcw(a) > mb() > > What stops the compiler from doing? > > mb() > *stack_slot = *a > reg1 = *stack_slot This is a mistake, and should read: reg1 = stack_slot e.g. Copy the address of the stack slot into reg1. > reg2 = __ldcw(reg1) > *a = *stack_slot > mb() > > Memory is consistent before and after the memory barriers, but the > operation is not atomic? > > While this seems stupid, the compile may create a memory temporary to > shuffle things around. The compiler creates memory temporaries all the times and expects the optimizers to see that the temporaries are not needed. However, sometimes the temporaries aren't removed. Cheers, Carlos. -- To unsubscribe from this list: send the line "unsubscribe linux-parisc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html