This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.

	* config/tc-riscv.c (riscv_handle_implicit_zero_offset): Rename
	`expr' parameter to `ep'.

 This has popped up as a regression in routine cross-target testing for an 
unrelated change and should be obvious.  OK to apply?

 gas/config/tc-riscv.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: binutils/gas/config/tc-riscv.c
--- binutils.orig/gas/config/tc-riscv.c	2018-01-17 23:59:44.000000000 +0000
+++ binutils/gas/config/tc-riscv.c	2018-01-18 15:07:37.797400998 +0000
@@ -1191,14 +1191,14 @@ my_getSmallExpression (expressionS *ep, 
    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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]