diff --git a/src/ssids/cpu/BuddyAllocator.hxx b/src/ssids/cpu/BuddyAllocator.hxx index 3ed56368..4b391de2 100644 --- a/src/ssids/cpu/BuddyAllocator.hxx +++ b/src/ssids/cpu/BuddyAllocator.hxx @@ -101,8 +101,6 @@ public: #endif /* MEM_STATS */ } ~Page() noexcept(false) { - if(next_ && head_[nlevel-1] != 0) - throw std::runtime_error("outstanding allocations on cleanup\n"); if(next_) { typename IntAllocTraits::allocator_type intAlloc(alloc_); IntAllocTraits::deallocate(intAlloc, next_, 1<<(nlevel-1)); diff --git a/src/ssids/cpu/kernels/block_ldlt.hxx b/src/ssids/cpu/kernels/block_ldlt.hxx index f79a7426..89d2524e 100644 --- a/src/ssids/cpu/kernels/block_ldlt.hxx +++ b/src/ssids/cpu/kernels/block_ldlt.hxx @@ -202,7 +202,9 @@ void find_maxloc(const int from, const T *a, int lda, T &bestv_out, int &rloc, i cloc = bc2[i].i; } } - bestv_out = a[cloc*lda+rloc]; + bestv_out = + (cloc < BLOCK_SIZE && rloc < BLOCK_SIZE) ? a[cloc*lda+rloc] + : 0.0; } /** Returns true if a 2x2 pivot can be stably inverted. @@ -298,6 +300,9 @@ void block_ldlt(int from, int *perm, T *a, int lda, T *d, T *ldwork, int t, m; // row and col location of maximum entry find_maxloc(p, a, lda, bestv, t, m); + // Handle case where find_maxloc failed (e.g., due to NaNs in the input) + if (t >= BLOCK_SIZE || m >= BLOCK_SIZE) throw SingularError(p); + // Handle case where everything remaining is small // NB: There might be delayed columns! if(fabs(bestv) < small) {