From: Michael Wallner Date: Tue, 5 Sep 2017 10:14:24 +0000 (+0200) Subject: fix size of array elements X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=9cb932e13dc98db9d72ac37f6ed11cd76634d37b;p=m6w6%2Fext-psi fix size of array elements --- diff --git a/src/libffi.c b/src/libffi.c index d01d907..2ba4831 100644 --- a/src/libffi.c +++ b/src/libffi.c @@ -217,7 +217,7 @@ static ffi_type **psi_ffi_struct_type_elements(struct psi_decl_struct *strct) { maxalign = type->alignment; } - assert(type->size == darg->layout->len); + assert(type->size <= darg->layout->len); if ((padding = psi_offset_padding(darg->layout->pos - offset, type->alignment))) { if (nels + padding + 1 > argc) { argc += padding; diff --git a/src/libjit.c b/src/libjit.c index 52562af..7c48191 100644 --- a/src/libjit.c +++ b/src/libjit.c @@ -151,7 +151,7 @@ static unsigned psi_jit_struct_type_elements(struct psi_decl_struct *strct, maxalign = alignment; } - assert(jit_type_get_size(type) == darg->layout->len); + assert(jit_type_get_size(type) <= darg->layout->len); if ((padding = psi_offset_padding(darg->layout->pos - offset, alignment))) { if (nels + padding > argc) { argc += padding; diff --git a/src/types/decl_arg.c b/src/types/decl_arg.c index 61aacef..0423c97 100644 --- a/src/types/decl_arg.c +++ b/src/types/decl_arg.c @@ -165,7 +165,7 @@ size_t psi_decl_arg_get_align(struct psi_decl_arg *darg) size_t align; if (darg->var->pointer_level - && (!darg->var->array_size || darg->var->pointer_level > 2)) { + && (!darg->var->array_size || darg->var->pointer_level > 1)) { align = psi_t_alignment(PSI_T_POINTER); } else { align = psi_decl_type_get_align(darg->type); @@ -180,7 +180,7 @@ size_t psi_decl_arg_get_size(struct psi_decl_arg *darg) struct psi_decl_type *real = psi_decl_type_get_real(darg->type); if (darg->var->array_size) { - if (darg->var->pointer_level > 2) { + if (darg->var->pointer_level > 1) { size = psi_t_size(PSI_T_POINTER) * darg->var->array_size; } else { size = psi_t_size(real->type) * darg->var->array_size;