Bernd Edlinger <bernd.edlin...@hotmail.de> writes: > Hi, > > I am currently trying to implement -Wshadow=local, and > this patch triggers a build-failure with -Wshadow=local > since i is a parameter that is the regno. > But it is also used as loop variable, > so I think this introduces probably a bug: > >> @@ -728,7 +731,11 @@ globalize_reg (tree decl, int i) >> appropriate regs_invalidated_by_call bit, even if it's already >> set in fixed_regs. */ >> if (i != STACK_POINTER_REGNUM) >> - SET_HARD_REG_BIT (regs_invalidated_by_call, i); >> + { >> + SET_HARD_REG_BIT (regs_invalidated_by_call, i); >> + for (unsigned int i = 0; i < NUM_ABI_IDS; ++i) >> + function_abis[i].add_full_reg_clobber (i); >> + } > > > I would think you meant: > > for (unsigned int j = 0; j < NUM_ABI_IDS; ++j) > function_abis[j].add_full_reg_clobber (i); > > Right?
Oops, yes. Applied as obvious after testing on aarch64-linux-gnu. Looking forward to the new -W option :-) Richard 2019-10-02 Richard Sandiford <richard.sandif...@arm.com> gcc/ * reginfo.c (globalize_reg): Fix shadowed variable in function_abis walk. Index: gcc/reginfo.c =================================================================== --- gcc/reginfo.c 2019-10-01 09:55:35.150088599 +0100 +++ gcc/reginfo.c 2019-10-02 14:12:15.379196856 +0100 @@ -731,8 +731,8 @@ globalize_reg (tree decl, int i) if (i != STACK_POINTER_REGNUM) { SET_HARD_REG_BIT (regs_invalidated_by_call, i); - for (unsigned int i = 0; i < NUM_ABI_IDS; ++i) - function_abis[i].add_full_reg_clobber (i); + for (unsigned int j = 0; j < NUM_ABI_IDS; ++j) + function_abis[j].add_full_reg_clobber (i); } /* If already fixed, nothing else to do. */