diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 8a961c05d95..71aca3eb4ab 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -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)) {