[PATCH] RISC-V: don't cast expressions' X_add_number to long in diagnostics

Jan Beulich jbeulich@suse.com
Fri Sep 30 09:42:50 GMT 2022


There's no need for such workarounds anymore now that we use C99
uniformly. This addresses several testsuite failures encountered when
(cross-)building on a 32-bit host.

--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -3338,14 +3338,14 @@ riscv_ip (char *str, struct riscv_cl_ins
 		      if (!sign)
 			{
 			  if (!VALIDATE_U_IMM (imm_expr->X_add_number, n))
-			    as_bad (_("improper immediate value (%lu)"),
-				    (unsigned long) imm_expr->X_add_number);
+			    as_bad (_("improper immediate value (%"PRIu64")"),
+				    imm_expr->X_add_number);
 			}
 		      else
 			{
 			  if (!VALIDATE_S_IMM (imm_expr->X_add_number, n))
-			    as_bad (_("improper immediate value (%li)"),
-				    (long) imm_expr->X_add_number);
+			    as_bad (_("improper immediate value (%"PRIi64")"),
+				    imm_expr->X_add_number);
 			}
 		      INSERT_IMM (n, s, *ip, imm_expr->X_add_number);
 		      imm_expr->X_op = O_absent;


More information about the Binutils mailing list