Skip to content

Commit

Permalink
RISC-V: Fix required bits on certain environments
Browse files Browse the repository at this point in the history
If `unsigned long long' type has more than 64-bits, validate_riscv_insn
function generated wrong required_bits value.  This commit fixes this
small issue (may be too pedantic though).

gas/ChangeLog:

	* config/tc-riscv.c (validate_riscv_insn): Compute correct
	required_bits value when unsigned long long is larger than 64b.
  • Loading branch information
a4lg committed Jul 7, 2022
1 parent d9b3ea0 commit a5f67b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gas/config/tc-riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length)
else
insn_width = 8 * length;

required_bits = ~0ULL >> (64 - insn_width);
required_bits = ((unsigned long long)(insn_t)~0ULL) >> (64 - insn_width);

if ((used_bits & opc->match) != (opc->match & required_bits))
{
Expand Down

0 comments on commit a5f67b9

Please sign in to comment.