@@ -1261,18 +1261,19 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12611261 if (ctype_isfunc (info )) {
12621262 TRef func = emitir (IRT (IR_FLOAD , tp ), J -> base [0 ], IRFL_CDATA_PTR );
12631263 CType * ctr = ctype_rawchild (cts , ct );
1264+ CTInfo ctr_info = ctr -> info ; /* crec_call_args may invalidate ctr. */
12641265 IRType t = crec_ct2irt (cts , ctr );
12651266 TRef tr ;
12661267 TValue tv ;
12671268 /* Check for blacklisted C functions that might call a callback. */
12681269 tv .u64 = ((uintptr_t )cdata_getptr (cdataptr (cd ), (LJ_64 && tp == IRT_P64 ) ? 8 : 4 ) >> 2 ) | U64x (800000000 , 00000000 );
12691270 if (tvistrue (lj_tab_get (J -> L , cts -> miscmap , & tv )))
12701271 lj_trace_err (J , LJ_TRERR_BLACKL );
1271- if (ctype_isvoid (ctr -> info )) {
1272+ if (ctype_isvoid (ctr_info )) {
12721273 t = IRT_NIL ;
12731274 rd -> nres = 0 ;
1274- } else if (!(ctype_isnum (ctr -> info ) || ctype_isptr (ctr -> info ) ||
1275- ctype_isenum (ctr -> info )) || t == IRT_CDATA ) {
1275+ } else if (!(ctype_isnum (ctr_info ) || ctype_isptr (ctr_info ) ||
1276+ ctype_isenum (ctr_info )) || t == IRT_CDATA ) {
12761277 lj_trace_err (J , LJ_TRERR_NYICALL );
12771278 }
12781279 if ((info & CTF_VARARG )
@@ -1283,7 +1284,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12831284 func = emitir (IRT (IR_CARG , IRT_NIL ), func ,
12841285 lj_ir_kint (J , ctype_typeid (cts , ct )));
12851286 tr = emitir (IRT (IR_CALLXS , t ), crec_call_args (J , rd , cts , ct ), func );
1286- if (ctype_isbool (ctr -> info )) {
1287+ if (ctype_isbool (ctr_info )) {
12871288 if (frame_islua (J -> L -> base - 1 ) && bc_b (frame_pc (J -> L -> base - 1 )[-1 ]) == 1 ) {
12881289 /* Don't check result if ignored. */
12891290 tr = TREF_NIL ;
@@ -1299,7 +1300,7 @@ static int crec_call(jit_State *J, RecordFFData *rd, GCcdata *cd)
12991300 tr = TREF_TRUE ;
13001301 }
13011302 } else if (t == IRT_PTR || (LJ_64 && t == IRT_P32 ) ||
1302- t == IRT_I64 || t == IRT_U64 || ctype_isenum (ctr -> info )) {
1303+ t == IRT_I64 || t == IRT_U64 || ctype_isenum (ctr_info )) {
13031304 TRef trid = lj_ir_kint (J , ctype_cid (info ));
13041305 tr = emitir (IRTG (IR_CNEWI , IRT_CDATA ), trid , tr );
13051306 if (t == IRT_I64 || t == IRT_U64 ) lj_needsplit (J );
0 commit comments