This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [01/32] Add function_abi.{h,cc}
- From: Richard Sandiford <richard dot sandiford at arm dot com>
- To: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- Cc: Jeff Law <law at redhat dot com>, "gcc-patches\@gcc.gnu.org" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 02 Oct 2019 14:14:19 +0100
- Subject: Re: [01/32] Add function_abi.{h,cc}
- References: <VI1PR03MB45280D65494FBC05986EA027E49D0@VI1PR03MB4528.eurprd03.prod.outlook.com>
Bernd Edlinger <bernd.edlinger@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.sandiford@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. */