diff --git a/src/util/debug.hpp b/src/util/debug.hpp
index dfc553924461f9d68c5aeaa951b667c26975909b..a2d53b513053b277f2a30a8c260587cbdbe7377d 100644
--- a/src/util/debug.hpp
+++ b/src/util/debug.hpp
@@ -7,7 +7,9 @@
 #include <utility>
 
 extern "C" {
-#include <endian.h>
+// The system header endian.h is not in /sys/include/ on Mac OS X.
+// Include sys/types.h, which pulls in endian.h on all systems.
+#include <sys/types.h>
 }
 
 #include <threading/threading.hpp>
diff --git a/tests/unit/test_padded.cpp b/tests/unit/test_padded.cpp
index ebe2049be6a34be395f1f4ebf8605223a9111560..7f2f52b38a4c171e3b99b545218b72f0b9587443 100644
--- a/tests/unit/test_padded.cpp
+++ b/tests/unit/test_padded.cpp
@@ -19,7 +19,7 @@ static bool is_aligned(void* p, std::size_t k) {
 
 TEST(padded_vector, alignment) {
     padded_allocator<double> pa(1024);
-    pvector<double> a(101, pa);
+    pvector<double> a(101, 0.0, pa);
 
     EXPECT_EQ(1024u, a.get_allocator().alignment());
     EXPECT_TRUE(is_aligned(a.data(), 1024));
@@ -29,14 +29,14 @@ TEST(padded_vector, allocator_constraints) {
     EXPECT_THROW(padded_allocator<char>(7), std::range_error);
 
     padded_allocator<char> pa(2); // less than sizeof(void*)
-    std::vector<char, padded_allocator<char>> v(7, pa);
+    std::vector<char, padded_allocator<char>> v(7, 'a', pa);
 
     EXPECT_TRUE(is_aligned(v.data(), sizeof(void*)));
 }
 
 TEST(padded_vector, allocator_propagation) {
     padded_allocator<double> pa(1024);
-    pvector<double> a(101, pa);
+    pvector<double> a(101, 0, pa);
 
     EXPECT_EQ(pa, a.get_allocator());