diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 4a563741e91c7eccb10ff2d87a4d23476c82c1a6..c6fb8c9fbe5ace8419fa3401e2957d58b2b3b7c7 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -37,6 +37,8 @@
 #include "bootstrap/bootstrap.h"
 #include "common/username.h"
 #include "postmaster/postmaster.h"
+#include "storage/barrier.h"
+#include "storage/spin.h"
 #include "tcop/tcopprot.h"
 #include "utils/help_config.h"
 #include "utils/memutils.h"
@@ -288,6 +290,12 @@ startup_hacks(const char *progname)
 		SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
 	}
 #endif   /* WIN32 */
+
+	/*
+	 * Initialize dummy_spinlock, in case we are on a platform where we have
+	 * to use the fallback implementation of pg_memory_barrier().
+	 */
+	SpinLockInit(&dummy_spinlock);
 }