mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-30 12:44:10 +08:00
RISC-V: fix build after "Add support for arbitrary immediate encoding formats"
Pre- and post-increment/decrement are side effects, the behavior of which is undefined when combined with passing an address of the accessed variable in the same function invocation. There's no need for the increments here - simply adding 1 achieves the intended effect without triggering compiler diagnostics (which are fatal with -Werror).
This commit is contained in:
parent
3bf4994276
commit
b0423163b8
@ -1287,10 +1287,10 @@ validate_riscv_insn (const struct riscv_opcode *opc, int length)
|
||||
case 'u': /* 'XuN@S' ... N-bit unsigned immediate at bit S. */
|
||||
goto use_imm;
|
||||
use_imm:
|
||||
n = strtol (++oparg, (char **)&oparg, 10);
|
||||
n = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
if (*oparg != '@')
|
||||
goto unknown_validate_operand;
|
||||
s = strtol (++oparg, (char **)&oparg, 10);
|
||||
s = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
oparg--;
|
||||
|
||||
USE_IMM (n, s);
|
||||
@ -3327,10 +3327,10 @@ riscv_ip (char *str, struct riscv_cl_insn *ip, expressionS *imm_expr,
|
||||
sign = false;
|
||||
goto parse_imm;
|
||||
parse_imm:
|
||||
n = strtol (++oparg, (char **)&oparg, 10);
|
||||
n = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
if (*oparg != '@')
|
||||
goto unknown_riscv_ip_operand;
|
||||
s = strtol (++oparg, (char **)&oparg, 10);
|
||||
s = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
oparg--;
|
||||
|
||||
my_getExpression (imm_expr, asarg);
|
||||
|
@ -586,10 +586,10 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
|
||||
sign = false;
|
||||
goto print_imm;
|
||||
print_imm:
|
||||
n = strtol (++oparg, (char **)&oparg, 10);
|
||||
n = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
if (*oparg != '@')
|
||||
goto undefined_modifier;
|
||||
s = strtol (++oparg, (char **)&oparg, 10);
|
||||
s = strtol (oparg + 1, (char **)&oparg, 10);
|
||||
oparg--;
|
||||
|
||||
if (!sign)
|
||||
|
Loading…
Reference in New Issue
Block a user