]> git.ipfire.org Git - thirdparty/gcc.git/commit
Ensure pool resources always use normal mode vector
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Jan 2019 00:47:25 +0000 (00:47 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Jan 2019 00:47:25 +0000 (00:47 +0000)
commit710397ad5bf8fff51890fe6a972097ce7ffa63fd
treefc2d3d9bb79c9d94adc789855952b43be97fb435
parent3a86f9010415bd2b50549f93c9b4808495c0e06c
Ensure pool resources always use normal mode vector

The __pool_resource::_M_unpooled member was declared with type
std::vector, which means that the type depends on whether debug mode is
active or not. Because the non-inline definitions in
src/c++17/memory_resource.cc are never compiled with debug mode, the
type declared in the header doesn't match the type in the library
definitions, leading to undefined behaviour.

The solution is to ensure the header always uses the non-debug vector,
even when debug mode is active. To make this easier a new alias template
is defined: _GLIBCXX_STD_C::pmr::vector.

* include/std/memory_resource (__pool_resource::_M_unpooled): Use
normal mode vector, even for debug mode.
* include/std/vector [_GLIBCXX_DEBUG] (_GLIBCXX_STD_C::pmr::vector):
Define alias template for normal mode vector.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268354 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/std/memory_resource
libstdc++-v3/include/std/vector