Skip to content

Commit

Permalink
riscv64-asm.c: asm_emit_j: correct check of immediate
Browse files Browse the repository at this point in the history
  • Loading branch information
CorruptedVor committed Dec 2, 2023
1 parent 0655fd9 commit 81a32ec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions riscv64-asm.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ static void asm_emit_j(int token, uint32_t opcode, const Operand* rd, const Oper

imm = rs2->e.v;

if (imm >= 0x100000) {
tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 0xfffff", get_tok_str(token, NULL));
/* even offsets in a +- 1 MiB range */
if (imm > 0x1ffffe) {
tcc_error("'%s': Expected second source operand that is an immediate value between 0 and 0x1fffff", get_tok_str(token, NULL));
return;
}

Expand Down

0 comments on commit 81a32ec

Please sign in to comment.