This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [01/32] Add function_abi.{h,cc}


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.  */


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