From 59e18ca3c00faa8e8d6f2ca6af41f26b163db6af Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 7 Jun 2023 14:02:55 +0900 Subject: [PATCH] Make hmu_tree_node 4 byte aligned to reduce compiler warning (#2268) --- core/shared/mem-alloc/ems/ems_gc_internal.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/shared/mem-alloc/ems/ems_gc_internal.h b/core/shared/mem-alloc/ems/ems_gc_internal.h index e1ff9d61..68b50545 100644 --- a/core/shared/mem-alloc/ems/ems_gc_internal.h +++ b/core/shared/mem-alloc/ems/ems_gc_internal.h @@ -214,13 +214,16 @@ set_hmu_normal_node_next(hmu_normal_node_t *node, hmu_normal_node_t *next) #if defined(_MSC_VER) __pragma(pack(push, 1)); #define __attr_packed +#define __attr_aligned(a) #elif defined(__GNUC__) || defined(__clang__) #define __attr_packed __attribute__((packed)) +#define __attr_aligned(a) __attribute__((aligned(a))) #else #error "packed attribute isn't used to define struct hmu_tree_node" #endif #else /* else of UINTPTR_MAX == UINT64_MAX */ #define __attr_packed +#define __attr_aligned(a) #endif typedef struct hmu_tree_node { @@ -229,7 +232,7 @@ typedef struct hmu_tree_node { struct hmu_tree_node *right; struct hmu_tree_node *parent; gc_size_t size; -} __attr_packed hmu_tree_node_t; +} __attr_packed __attr_aligned(4) hmu_tree_node_t; #if UINTPTR_MAX == UINT64_MAX #if defined(_MSC_VER)