Closed jfowkes closed 5 months ago
As reported by @nimgould compilers currently raise a warning for this section of BuddyAllocator.hxx:
BuddyAllocator.hxx
void* allocate(std::size_t sz) { // Try allocating in existing pages spral::omp::AcquiredLock scopeLock(lock_); void* ptr; for(auto& page: pages_) { ptr = page.allocate(sz); if(ptr) break; // allocation suceeded } if(!ptr) { // Failed to alloc on existing page: make a bigger page and use it
that the pointer may be used uninitialised:
warning: ‘ptr’ may be used uninitialized in this function | if(!ptr) {
This PR explicitly initialises the pointer to nullptr rather than expecting the compiler to do this.
Agreed thanks @mjacobse!
As reported by @nimgould compilers currently raise a warning for this section of
BuddyAllocator.hxx
:that the pointer may be used uninitialised:
This PR explicitly initialises the pointer to nullptr rather than expecting the compiler to do this.