From 89424b1d6965bcda21a225d0f545f43d9294ff21 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 5 Feb 2018 14:05:51 +0000 Subject: [PATCH] RISC-V/GAS: Correct an `expr' global shadowing error for pre-4.8 GCC Correct a commit f0531ed6a429 ("Compress loads/stores with implicit 0 offset.") regression and remove a `-Wshadow' compilation error: cc1: warnings being treated as errors .../gas/config/tc-riscv.c: In function 'riscv_handle_implicit_zero_offset': .../gas/config/tc-riscv.c:1194: error: declaration of 'expr' shadows a global declaration .../gas/expr.h:180: error: shadowed declaration is here make[4]: *** [tc-riscv.o] Error 1 which for versions of GCC before 4.8 prevents GAS for RISC-V targets from being built. See also GCC PR c/53066. gas/ * config/tc-riscv.c (riscv_handle_implicit_zero_offset): Rename `expr' parameter to `ep'. --- gas/ChangeLog | 5 +++++ gas/config/tc-riscv.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6c9ff3e3456..45ad93b0d17 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2018-02-05 Maciej W. Rozycki + + * config/tc-riscv.c (riscv_handle_implicit_zero_offset): Rename + `expr' parameter to `ep'. + 2018-02-05 Maciej W. Rozycki * testsuite/gas/mips/reginfo-2.d: New test. diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index a84240db200..f1bc7f98041 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -1191,14 +1191,14 @@ my_getSmallExpression (expressionS *ep, bfd_reloc_code_real_type *reloc, an implicit offset was detected. */ static bfd_boolean -riscv_handle_implicit_zero_offset (expressionS *expr, const char *s) +riscv_handle_implicit_zero_offset (expressionS *ep, const char *s) { /* Check whether there is only a single bracketed expression left. If so, it must be the base register and the constant must be zero. */ if (*s == '(' && strchr (s + 1, '(') == 0) { - expr->X_op = O_constant; - expr->X_add_number = 0; + ep->X_op = O_constant; + ep->X_add_number = 0; return TRUE; } -- 2.30.2