https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94160
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testcase:
#include <memory_resource>
int main()
{
std::pmr::unsynchronized_pool_resource upr({ 1, 32 });
auto* p = (int*)upr.allocate(4);
*p = 0;
return *p;
}
The returned pointer is null, leading to a segfault.
If libstdc++ is built with assertions enabled, the allocation aborts with:
../../../../../libstdc++-v3/src/c++17/memory_resource.cc:294:
std::pmr::{anonymous}::bitset::bitset(void*,
std::pmr::{anonymous}::bitset::size_type): Assertion 'empty()' failed.