From 1259f52fa8ad2ccd03b190b59993b5e993082f89 Mon Sep 17 00:00:00 2001 From: Leonardo de Moura Date: Wed, 16 Sep 2015 07:38:00 -0700 Subject: [PATCH] chore(runtime/cpp/lean_runtime): add assertion to make sure we are satisfying alignment constraints --- src/runtime/cpp/lean_runtime.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/runtime/cpp/lean_runtime.cpp b/src/runtime/cpp/lean_runtime.cpp index af3ef6070..026ae715b 100644 --- a/src/runtime/cpp/lean_runtime.cpp +++ b/src/runtime/cpp/lean_runtime.cpp @@ -68,6 +68,7 @@ void * alloc_obj(unsigned n) { obj_cell::obj_cell(unsigned cidx, unsigned sz, obj const * fs): m_rc(0), m_kind(static_cast(obj_kind::Constructor)), m_size(sz), m_cidx(cidx) { + static_assert(sizeof(obj_cell) % sizeof(void*) == 0); // make sure the hack used to store obj_cell fields satisfies alignment constraints. void ** mem = field_addr(); for (unsigned i = 0; i < sz; i++, mem++) new (mem) obj(fs[i]);