On 24/02/2017 13:12, Dr. David Alan Gilbert wrote:
>> Ok, yeah, it makes sense that the compiler can optimize that away without
>> volatile. I wonder if adding volatile has much of a performance impact on
>> this loop...
> I don't think we have anything else in QEMU to do it (other than atomic's
> but we don't need this to be atomic).   I don't think the use of memset()
> helps, because the compiler is free to optimise that out as well; so
> I think 'volatile' is a reasonable use (although I seem to have a soft-spot
> for volatile and I know everyone else tells me I'm mad).

Yes, I think it is fine to use volatile here.

Paolo

Reply via email to