1
0
Fork 0

riscv64-asm.c: fix assembly instruction with negative immediate offsets.

This fixes expressions like ld a0, s0, -24 that regressed in
d87801bd50
This commit is contained in:
Andrius Štikonas 2024-01-12 21:06:46 +00:00
parent 6120656cbf
commit 04365dd4c9
1 changed files with 1 additions and 1 deletions

View File

@ -189,7 +189,7 @@ static void parse_operand(TCCState *s1, Operand *op)
op->e = e;
/* compare against unsigned 12-bit maximum */
if (!op->e.sym) {
if (op->e.v < 0x1000)
if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000)
op->type = OP_IM12S;
} else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) {
label.type.t = VT_VOID | VT_STATIC;