From: Jan Beulich <jbeulich@suse.com>
To: Binutils <binutils@sourceware.org>
Cc: "Palmer Dabbelt" <palmer@dabbelt.com>,
"Andrew Waterman" <andrew@sifive.com>,
"Jim Wilson" <jim.wilson.gcc@gmail.com>,
"Nelson Chu" <nelson@rivosinc.com>,
"Christoph Müllner" <christoph.muellner@vrull.eu>
Subject: [PATCH] RISC-V: fix build after "Add support for arbitrary immediate encoding formats"
Date: Fri, 30 Sep 2022 11:41:29 +0200 [thread overview]
Message-ID: <5874dd79-0cf5-d65c-7ea2-13adfc799c0f@suse.com> (raw)
In-Reply-To: <7cb92a0b-d1ef-e3db-4773-0b6cd5183272@suse.com>
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).
---
Committing as obvious.
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -1287,10 +1287,10 @@ validate_riscv_insn (const struct riscv_
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_ins
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);
--- a/opcodes/riscv-dis.c
+++ b/opcodes/riscv-dis.c
@@ -586,10 +586,10 @@ print_insn_args (const char *oparg, insn
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)
next prev parent reply other threads:[~2022-09-30 9:41 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 12:59 [PATCH 0/3] RISC-V: alias insn adjustments Jan Beulich
2022-09-13 13:02 ` [PATCH 1/3] RISC-V: re-arrange opcode table for consistent alias handling Jan Beulich
2022-09-15 2:30 ` Nelson Chu
2022-09-15 7:42 ` Jan Beulich
2022-09-16 9:53 ` Nelson Chu
2023-07-11 21:02 ` Fangrui Song
[not found] ` <DS7PR12MB576580071090C394AECFC618CB31A@DS7PR12MB5765.namprd12.prod.outlook.com>
2023-07-12 8:15 ` Jan Beulich
2023-07-14 21:25 ` Fangrui Song
[not found] ` <MN0PR12MB57613B59178FAADE5FCD3837CB34A@MN0PR12MB5761.namprd12.prod.outlook.com>
2023-07-14 22:08 ` Stefan O'Rear
2023-07-17 6:50 ` Jan Beulich
2023-07-21 22:16 ` Song Fangrui
2023-07-22 15:14 ` Jeff Law
2023-07-22 16:55 ` Andrew Waterman
[not found] ` <DS7PR12MB57658EF28577B41BF35C5E7CCB3FA@DS7PR12MB5765.namprd12.prod.outlook.com>
2023-07-24 7:23 ` Jan Beulich
2023-08-30 3:14 ` Fangrui Song
2022-09-13 13:03 ` [PATCH 2/3] RISC-V: drop stray INSN_ALIAS flags Jan Beulich
2022-09-15 2:43 ` Nelson Chu
2022-09-13 13:04 ` [PATCH 3/3] RISC-V: add alias for SLLI.UW Jan Beulich
2022-09-13 14:54 ` [PATCH 0/3] RISC-V: alias insn adjustments Tsukasa OI
2022-09-13 16:11 ` Jan Beulich
2022-09-13 16:58 ` Tsukasa OI
2022-09-14 6:26 ` Jan Beulich
2022-09-30 9:41 ` Jan Beulich [this message]
2022-09-30 10:26 ` [PATCH] RISC-V: fix build after "Add support for arbitrary immediate encoding formats" Christoph Müllner
2022-09-30 22:17 ` Palmer Dabbelt
2022-09-30 9:42 ` [PATCH] RISC-V: fallout from "re-arrange opcode table for consistent alias handling" Jan Beulich
2022-09-30 9:42 ` [PATCH] RISC-V: don't cast expressions' X_add_number to long in diagnostics Jan Beulich
2022-09-30 10:13 ` Christoph Müllner
2022-09-30 14:43 ` Nelson Chu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5874dd79-0cf5-d65c-7ea2-13adfc799c0f@suse.com \
--to=jbeulich@suse.com \
--cc=andrew@sifive.com \
--cc=binutils@sourceware.org \
--cc=christoph.muellner@vrull.eu \
--cc=jim.wilson.gcc@gmail.com \
--cc=nelson@rivosinc.com \
--cc=palmer@dabbelt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).