From 51cc9c034771d8e0ef9d0f95bb454258fccc63a4 Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Sat, 2 Sep 2017 19:35:39 +0100 Subject: [PATCH] Fix updating ivars to the new structure. Some types (e.g. vectors) end up with empty type encodings, for these cases we assume void* alignment. --- ivar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ivar.c b/ivar.c index 96a0ede..20b8c42 100644 --- a/ivar.c +++ b/ivar.c @@ -202,7 +202,8 @@ static struct objc_ivar_list *upgradeIvarList(Class cls, struct objc_ivar_list_l n->ivar_list[i].name = l->ivar_list[i].name; n->ivar_list[i].type = l->ivar_list[i].type; n->ivar_list[i].offset = l->ivar_list[i].offset; - n->ivar_list[i].align = objc_alignof_type(n->ivar_list[i].type); + const char *type = l->ivar_list[i].type; + n->ivar_list[i].align = ((type == NULL) || type[0] == 0) ? __alignof__(void*) : objc_alignof_type(type); ivarSetOwnership(&n->ivar_list[i], ownershipForIvar(cls, i)); } return n;