diff --git a/Control/AthContainers/Root/AuxVectorData.cxx b/Control/AthContainers/Root/AuxVectorData.cxx
index 42fa0b11843a6dbe168b0deaf77df589b2e2c754..6d0c881998fc41e64c3af873ffeb5b021dcc4c66 100644
--- a/Control/AthContainers/Root/AuxVectorData.cxx
+++ b/Control/AthContainers/Root/AuxVectorData.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 /**
  * @file AthContainers/src/AuxVectorData.cxx
@@ -515,6 +515,9 @@ void AuxVectorData::Cache::store (SG::auxid_t auxid, void* ptr)
     std::fill (newcache + m_cache_len, newcache + newlen,
                static_cast<void*>(0));
 
+    // The above writes must be visible before we update the cache pointers.
+    AthContainers_detail::fence_seq_cst();
+
     // Store so that other threads can see it.
     // The stores to m_cache must happen before the store to m_cache_len;
     // we use a fence to ensure this.
diff --git a/Control/AthContainers/test/AuxVectorData_test.cxx b/Control/AthContainers/test/AuxVectorData_test.cxx
index fdcd8f60a54294bff925baad0b7acd56b9cc8d27..e5f572504af9521b530c1d23c8fded7ab3c84352 100644
--- a/Control/AthContainers/test/AuxVectorData_test.cxx
+++ b/Control/AthContainers/test/AuxVectorData_test.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 */
 
 // $Id$
@@ -348,8 +348,8 @@ void ThreadingTest::threadedTest()
   AuxVectorData_test b;
   b.setStore (&m_store);
 
-  int nthread = 10;
-  AthContainers_detail::thread threads[10];
+  constexpr int nthread = 10;
+  AthContainers_detail::thread threads[nthread];
   m_sm.lock();
   for (int i=0; i < nthread; i++)
     threads[i] = AthContainers_detail::thread (testThread (*this, b, i));