Created on 2011-02-26.00:00:00 last changed 162 months ago
Proposed resolution:
Change [new.delete.dataraces] p. 1 as follows:
1
The library versions of operator new and operator delete, user replacement versions of global operator new and operator delete, and the C standard library functions calloc, malloc, realloc, and free shall not introduce data races ([intro.multithread]) as a result of concurrent calls from different threads.For purposes of determining the existence of data races, the library versions of operator new, user replacement versions of global operator new, and the C standard library functions calloc and malloc shall behave as though they accessed and modified only the storage referenced by the return value. The library versions of operator delete, user replacement versions of operator delete, and the C standard library function free shall behave as though they accessed and modified only the storage referenced by their first argument. The C standard library realloc function shall behave as though it accessed and modified only the storage referenced by its first argument and by its return value. Calls to these functions that allocate or deallocate a particular unit of storage shall occur in a single total order, and each such deallocation call shall happen before the next allocation (if any) in this order.
[ Adopted at Madrid, 2011-03 ]
[ 2011-02-26: Hans comments and drafts wording ]
The second requirement already exists, almost verbatim, as [new.delete.dataraces] p. 1. I think this is where the statement belongs. However, this paragraph requires work to correctly address the first part of the issue.
Addresses US-34
Technical details:
When the same unit of storage is allocated and deallocated repeatedly, operations on it can't be allowed to race between the allocator and the user program. But I don't see any mention of happens-before in the descriptions of allocation and deallocation functions. Proposed resolution (not wording yet):The call to an allocation function returning a pointer P must happen-before the matching deallocation call with P as a parameter. Otherwise the behavior is undefined. I don't know whether receiving P with memory_order_consume fits this requirement. memory_order_relaxed does not.
If some memory is passed to a deallocation function, the implementation must ensure that the deallocation call happens-before any allocation call that returns the same memory address.
History | |||
---|---|---|---|
Date | User | Action | Args |
2011-08-23 20:07:26 | admin | set | status: wp -> c++11 |
2011-04-11 11:23:23 | admin | set | status: immediate -> wp |
2011-03-24 21:43:06 | admin | set | messages: + msg5706 |
2011-03-24 21:43:06 | admin | set | status: new -> immediate |
2011-02-26 11:16:37 | admin | set | messages: + msg5555 |
2011-02-26 11:16:37 | admin | set | messages: + msg5554 |
2011-02-26 00:00:00 | admin | create |