DUALNUM: Fix narrowing of unary minus.

Reported by Sergey Kaplun. #1418
This commit is contained in:
Mike Pall
2025-12-06 08:39:11 +01:00
parent 53d014fea8
commit b1cd2f83b5

View File

@@ -545,9 +545,9 @@ TRef lj_opt_narrow_unm(jit_State *J, TRef rc, TValue *vc)
rc = conv_str_tonum(J, rc, vc);
if (tref_isinteger(rc)) {
uint32_t k = (uint32_t)numberVint(vc);
if ((LJ_DUALNUM || k != 0) && k != 0x80000000u) {
if ((tvisint(vc) || k != 0) && k != 0x80000000u) {
TRef zero = lj_ir_kint(J, 0);
if (!LJ_DUALNUM)
if (!tvisint(vc))
emitir(IRTGI(IR_NE), rc, zero);
return emitir(IRTGI(IR_SUBOV), zero, rc);
}