]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
FFI: Fix recording of union initialization.
authorMike Pall <mike>
Mon, 28 Dec 2020 11:37:36 +0000 (12:37 +0100)
committerMike Pall <mike>
Mon, 28 Dec 2020 11:37:36 +0000 (12:37 +0100)
Thanks to Alex Shpilkin.

src/lj_crecord.c

index 6e3c36a17320d86e12aeabb93d3990d46223575c..0287b95beb41a63ea8cc679712b5a7dd417826b1 100644 (file)
@@ -959,6 +959,11 @@ static void crec_alloc(jit_State *J, RecordFFData *rd, CTypeID id)
          dp = emitir(IRT(IR_ADD, IRT_PTR), trcd,
                      lj_ir_kintp(J, df->size + sizeof(GCcdata)));
          crec_ct_tv(J, dc, dp, sp, sval);
+         if ((d->info & CTF_UNION)) {
+           if (d->size != dc->size)  /* NYI: partial init of union. */
+             lj_trace_err(J, LJ_TRERR_NYICONV);
+           break;
+         }
        } else if (!ctype_isconstval(df->info)) {
          /* NYI: init bitfields and sub-structures. */
          lj_trace_err(J, LJ_TRERR_NYICONV);