fix size of array elements
authorMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 10:14:24 +0000 (12:14 +0200)
committerMichael Wallner <mike@php.net>
Tue, 5 Sep 2017 10:14:24 +0000 (12:14 +0200)
src/libffi.c
src/libjit.c
src/types/decl_arg.c

index d01d907d36db2ded651f2eaaa8ee0c4336ff236d..2ba48319c0d9a8c28f5c47ffa4aa57613c0d7b42 100644 (file)
@@ -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;
index 52562affe239d8b79dd3201e5883700b61426079..7c4819121869af2e6695947b025ce16bfb81b287 100644 (file)
@@ -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;
index 61aacef3641ad2b0b205449273a9a86b8d3e25b3..0423c9728fb4ab6355bb821a2a23f4e55b5323b3 100644 (file)
@@ -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;