sljit: Pacify -Wsign-compare.
If these sizes are negative, we're probably in trouble anyway, so assert nonnegative here. Needed to resolve PR 58103.
This commit is contained in:
parent
717c76abf5
commit
d0ccdab6f4
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: sljitNativeARM_64.c,v 1.4 2019/01/20 23:14:16 alnsn Exp $ */
|
/* $NetBSD: sljitNativeARM_64.c,v 1.5 2024/04/02 22:29:57 riastradh Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stack-less Just-In-Time compiler
|
* Stack-less Just-In-Time compiler
|
||||||
|
@ -1079,7 +1079,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
|
||||||
local_size = (local_size + 15) & ~0xf;
|
local_size = (local_size + 15) & ~0xf;
|
||||||
compiler->local_size = local_size;
|
compiler->local_size = local_size;
|
||||||
|
|
||||||
if (local_size <= (63 * sizeof(sljit_sw))) {
|
SLJIT_ASSERT(local_size >= 0);
|
||||||
|
if ((size_t)local_size <= (63 * sizeof(sljit_sw))) {
|
||||||
FAIL_IF(push_inst(compiler, STP_PRE | 29 | RT2(TMP_LR)
|
FAIL_IF(push_inst(compiler, STP_PRE | 29 | RT2(TMP_LR)
|
||||||
| RN(TMP_SP) | ((-(local_size >> 3) & 0x7f) << 15)));
|
| RN(TMP_SP) | ((-(local_size >> 3) & 0x7f) << 15)));
|
||||||
FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RN(TMP_SP) | (0 << 10)));
|
FAIL_IF(push_inst(compiler, ADDI | RD(SLJIT_SP) | RN(TMP_SP) | (0 << 10)));
|
||||||
|
@ -1129,7 +1130,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compi
|
||||||
|
|
||||||
SLJIT_ASSERT(prev == -1);
|
SLJIT_ASSERT(prev == -1);
|
||||||
|
|
||||||
if (compiler->local_size > (63 * sizeof(sljit_sw))) {
|
SLJIT_ASSERT(compiler->local_size >= 0);
|
||||||
|
if ((size_t)compiler->local_size > (63 * sizeof(sljit_sw))) {
|
||||||
/* The local_size is already adjusted by the saved registers. */
|
/* The local_size is already adjusted by the saved registers. */
|
||||||
if (local_size > 0xfff) {
|
if (local_size > 0xfff) {
|
||||||
FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | ((local_size >> 12) << 10) | (1 << 22)));
|
FAIL_IF(push_inst(compiler, SUBI | RD(TMP_SP) | RN(TMP_SP) | ((local_size >> 12) << 10) | (1 << 22)));
|
||||||
|
@ -1179,7 +1181,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
|
||||||
local_size = compiler->local_size;
|
local_size = compiler->local_size;
|
||||||
|
|
||||||
saved_regs_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 0);
|
saved_regs_size = GET_SAVED_REGISTERS_SIZE(compiler->scratches, compiler->saveds, 0);
|
||||||
if (local_size <= (63 * sizeof(sljit_sw)))
|
SLJIT_ASSERT(local_size >= 0);
|
||||||
|
if ((size_t)local_size <= (63 * sizeof(sljit_sw)))
|
||||||
offs = (local_size - saved_regs_size) << (15 - 3);
|
offs = (local_size - saved_regs_size) << (15 - 3);
|
||||||
else {
|
else {
|
||||||
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
|
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
|
||||||
|
@ -1232,7 +1235,8 @@ SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *comp
|
||||||
|
|
||||||
SLJIT_ASSERT(prev == -1);
|
SLJIT_ASSERT(prev == -1);
|
||||||
|
|
||||||
if (compiler->local_size <= (63 * sizeof(sljit_sw))) {
|
SLJIT_ASSERT(compiler->local_size >= 0);
|
||||||
|
if ((size_t)compiler->local_size <= (63 * sizeof(sljit_sw))) {
|
||||||
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
|
FAIL_IF(push_inst(compiler, LDP_PST | 29 | RT2(TMP_LR)
|
||||||
| RN(TMP_SP) | (((local_size >> 3) & 0x7f) << 15)));
|
| RN(TMP_SP) | (((local_size >> 3) & 0x7f) << 15)));
|
||||||
} else if (saved_regs_size > 0) {
|
} else if (saved_regs_size > 0) {
|
||||||
|
|
Loading…
Reference in New Issue