Created on 2012-01-03.00:00:00 last changed 130 months ago
[Moved to DR at the October, 2012 meeting.]
Proposed resolution (February, 2012):
Change 6.7.5.5.3 [basic.stc.dynamic.deallocation] paragraph 4 as follows:
If the argument given to a deallocation function in the standard library is a pointer that is not the null pointer value (7.3.12 [conv.ptr]), the deallocation function shall deallocate the storage referenced by the pointer, rendering invalid all pointers referring to any part of the deallocated storage.The effect of using an invalid pointer value (including passing it to a deallocation function) is undefinedIndirection through an invalid pointer value and passing an invalid pointer value to a deallocation function have undefined behavior. Any other use of an invalid pointer value has implementation-defined behavior. [Footnote:On someSome implementations, itmight define that copying an invalid pointer value causes a system-generated runtime fault. —end footnote]
The current Standard says that any use of an invalid pointer value produces undefined behavior (6.7.5.5.3 [basic.stc.dynamic.deallocation] paragraph 4). This includes not only dereferencing the pointer but even just fetching its value. The reason for this draconian restriction is that some architectures in the past used dedicated address registers for pointer loads and stores and they could fault if, for example, a segment number in a pointer was not currently mapped.
It is not clear whether such restrictions are necessary with architectures currently in use or reasonably foreseen. This should be investigated to see if the restriction can be loosened to apply only to dereferencing the pointer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2014-03-03 00:00:00 | admin | set | status: drwp -> cd3 |
2013-05-03 00:00:00 | admin | set | status: dr -> drwp |
2012-11-03 00:00:00 | admin | set | messages: + msg4119 |
2012-11-03 00:00:00 | admin | set | status: ready -> dr |
2012-02-27 00:00:00 | admin | set | messages: + msg3690 |
2012-02-27 00:00:00 | admin | set | status: open -> ready |
2012-01-03 00:00:00 | admin | create |