volatile qualifier hurts single-threaded optimized case

Paolo Carlini pcarlini@suse.de
Wed Aug 30 12:18:00 GMT 2006


Richard Guenther wrote:

> There is this bug in the accounting code where we non-atomically update
>
>       // Return this block to our list and update counters and
>        // owner id as needed.
>        --__bin._M_used[__block->_M_thread_id];
>
> where __block->_M_thread_id does not need to be equal to __thread_id.
> But this is unrelated to having volatile or not, as only _M_used pointer
> is volatile, not the value we decrement here.

Exactly.

Paolo.



More information about the Libstdc++ mailing list