Created on 2015-12-02.00:00:00 last changed 47 months ago
Proposed resolution (March, 2019):
Change 6.7.5.5.2 [basic.stc.dynamic.allocation] paragraph 2 as follows:
...The order, contiguity, and initial value of storage allocated by successive calls to an allocation function are unspecified.For an allocation function other than a reserved placement allocation function (17.6.3.4 [new.delete.placement]), the pointer returned is suitably aligned so that it can be converted to a pointer to any suitable complete object type (17.6.3.2 [new.delete.single]) and then used to access the object or array in the storage allocated (until the storage is explicitly deallocated by a call to a corresponding deallocation function).Even if the size of the space requested...
Add the following as a new paragraph to 6.7.5.5.2 [basic.stc.dynamic.allocation] after the existing paragraph 2:
For an allocation function other than a reserved placement allocation function (17.6.3.4 [new.delete.placement]), the pointer returned on a successful call shall represent the address of storage that is aligned as follows:
If the allocation function takes an argument of type std::align_val_t, then the storage will have the alignment specified by the value of this argument.
Otherwise, if the allocation function is named operator new[], then the storage is aligned for any object that does not have new-extended alignment (6.7.6 [basic.align]) and is no larger than the requested size.
Otherwise, the storage is aligned for any object that does not have new-extended alignment and is of the requested size.
Change 17.6.3.2 [new.delete.single] paragraph 1 as follows:
Effects: The allocation functions (6.7.5.5.2 [basic.stc.dynamic.allocation]) called by a new-expression (7.6.2.8 [expr.new]) to allocate size bytes of storage. The second form is called for a type with new-extended alignment, andallocates storage with the specified alignment. Thethe first form is called otherwise, and allocates storage suitably aligned to represent any object of that size provided the object's type does not have new-extended alignment.
Change 17.6.3.3 [new.delete.array] paragraph 1 as follows:
Effects: The allocation functions (6.7.5.5.2 [basic.stc.dynamic.allocation]) called by the array form of a new-expression (7.6.2.8 [expr.new]) to allocate size bytes of storage. The second form is called for a type with new-extended alignment, andallocates storage with the specified alignment. Thethe first form is called otherwise, and allocates storage suitably aligned to represent any array object of that size or smaller, provided the object's type does not have new-extended alignment.218
[Accepted as a DR at the July, 2019 meeting.]
According to 6.7.5.5.2 [basic.stc.dynamic.allocation] paragraph 2,
For an allocation function other than a reserved placement allocation function (17.6.3.4 [new.delete.placement]), the pointer returned is suitably aligned so that it can be converted to a pointer to any suitable complete object type (17.6.3.2 [new.delete.single]) and then used to access the object or array in the storage allocated (until the storage is explicitly deallocated by a call to a corresponding deallocation function).
This requirement seems excessive, as it appears to require the strictest fundamental alignment even for objects that are too small to require such an alignment.
History | |||
---|---|---|---|
Date | User | Action | Args |
2020-12-15 00:00:00 | admin | set | messages: + msg6363 |
2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
2018-02-27 00:00:00 | admin | set | status: open -> drafting |
2015-12-02 00:00:00 | admin | create |