From 6557bdd83c6bb1ff8581155b7ac66358322ed2c4 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Sun, 16 Oct 2016 18:08:55 +0200 Subject: [PATCH] ensure allocation of an even number of elements --- include/deal.II/lac/vector_operations_internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 593256c0eb..54167ff4d6 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -1146,7 +1146,9 @@ namespace internal if (n_chunks > threshold_array_allocate) { - large_array.resize(n_chunks); + // make sure we allocate an even number of elements, + // access to the new last element is needed in do_sum() + large_array.resize(2*((n_chunks+1)/2)); array_ptr = &large_array[0]; } else -- 2.39.5