volatile qualifier hurts single-threaded optimized case

Richard Guenther richard.guenther@gmail.com
Wed Aug 30 12:16:00 GMT 2006

On 8/30/06, Paolo Carlini <pcarlini@suse.de> wrote:
> Richard Guenther wrote:
> > I got from Paolo that we do not care about rope anyway, so I'll ignore
> > that in
> > the following.  Patches for mt_allocator and pool_allocator have been
> > posted
> > and discussed here: http://gcc.gnu.org/ml/libstdc++/2006-07/msg00031.html
> > I think the pool_allocator patch is not safe because it changes
> > function signatures,
> > while the mt_allocator patch is still applicable to v3.
> Too bad, because the pool_allocator patch seemed absolutely safe from
> every possible point of view. I'm afraid the same cannot be said about
> the mt_allocator patch: in that case we *do* have a long standing race
> in the deallocation function (in Bugzilla) and if only part of Hans
> reasoning applies to that specific code, I would not remove the volatiles...

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.

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.


More information about the Libstdc++ mailing list