Work around bugs in gcc's analysis

Under `-m32 -O3` builds, it seems like gcc gets confused by the usage of malloc and calloc so we opt into the C++ versions, operator new and delete
This commit is contained in:
Christian Mazakas
2023-09-27 11:44:45 -07:00
parent 777f2084a3
commit 423eb08f00
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -30,13 +30,13 @@ template <typename T> struct A
{
total_allocation += n * sizeof(T);
++num_allocations;
return (T*)std::calloc(n, sizeof(T));
return (T*)(::operator new(n * sizeof(T)));
}
void deallocate(T* p, std::size_t n) noexcept
{
total_allocation -= n * sizeof(T);
std::free(p);
::operator delete(p);
}
bool operator==(A const& a) const { return i == a.i; }