diff options
-rw-r--r-- | src/lj_cdata.c | 6 | ||||
-rw-r--r-- | src/lj_crecord.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/lj_cdata.c b/src/lj_cdata.c index a3257249..af78d05e 100644 --- a/src/lj_cdata.c +++ b/src/lj_cdata.c | |||
@@ -94,10 +94,12 @@ collect_attrib: | |||
94 | if (ctype_ispointer(ct->info)) { | 94 | if (ctype_ispointer(ct->info)) { |
95 | CTSize sz = lj_ctype_size(cts, ctype_cid(ct->info)); /* Element size. */ | 95 | CTSize sz = lj_ctype_size(cts, ctype_cid(ct->info)); /* Element size. */ |
96 | if (sz != CTSIZE_INVALID) { | 96 | if (sz != CTSIZE_INVALID) { |
97 | if (ctype_isptr(ct->info)) | 97 | if (ctype_isptr(ct->info)) { |
98 | p = (uint8_t *)cdata_getptr(p, ct->size); | 98 | p = (uint8_t *)cdata_getptr(p, ct->size); |
99 | else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) | 99 | } else if ((ct->info & (CTF_VECTOR|CTF_COMPLEX))) { |
100 | if ((ct->info & CTF_COMPLEX)) idx &= 1; | ||
100 | *qual |= CTF_CONST; /* Valarray elements are constant. */ | 101 | *qual |= CTF_CONST; /* Valarray elements are constant. */ |
102 | } | ||
101 | *pp = p + idx*(int32_t)sz; | 103 | *pp = p + idx*(int32_t)sz; |
102 | return ct; | 104 | return ct; |
103 | } | 105 | } |
diff --git a/src/lj_crecord.c b/src/lj_crecord.c index 86e95679..61210907 100644 --- a/src/lj_crecord.c +++ b/src/lj_crecord.c | |||
@@ -483,7 +483,10 @@ void LJ_FASTCALL recff_cdata_index(jit_State *J, RecordFFData *rd) | |||
483 | #endif | 483 | #endif |
484 | integer_key: | 484 | integer_key: |
485 | if (ctype_ispointer(ct->info)) { | 485 | if (ctype_ispointer(ct->info)) { |
486 | CTSize sz = lj_ctype_size(cts, (sid = ctype_cid(ct->info))); | 486 | CTSize sz; |
487 | if ((ct->info & CTF_COMPLEX)) | ||
488 | idx = emitir(IRT(IR_BAND, IRT_INTP), idx, lj_ir_kintp(J, 1)); | ||
489 | sz = lj_ctype_size(cts, (sid = ctype_cid(ct->info))); | ||
487 | idx = crec_reassoc_ofs(J, idx, &ofs, sz); | 490 | idx = crec_reassoc_ofs(J, idx, &ofs, sz); |
488 | idx = emitir(IRT(IR_MUL, IRT_INTP), idx, lj_ir_kintp(J, sz)); | 491 | idx = emitir(IRT(IR_MUL, IRT_INTP), idx, lj_ir_kintp(J, sz)); |
489 | ptr = emitir(IRT(IR_ADD, IRT_PTR), idx, ptr); | 492 | ptr = emitir(IRT(IR_ADD, IRT_PTR), idx, ptr); |