[PATCH] Fix a recent warning in reorg.c
Bernd Schmidt
bschmidt@redhat.com
Tue Apr 26 13:12:00 GMT 2016
On 04/26/2016 03:08 PM, Jakub Jelinek wrote:
> It is not fatal, but still ugly. The problem is that the function has
> int i;
> ...
> for (i = 0; ...)
> ...
> for (unsigned int i = ... )
> ...
> for (i = 0; ...)
> This patch just declares the var in the only affected loop, so that the warning
> is not emitted, unless we start checking -Wshadow warnings, I think this is
> good enough.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2016-04-26 Jakub Jelinek <jakub@redhat.com>
>
> * reorg.c (try_merge_delay_insns): Declare i inside the last
> for loop to avoid warning.
>
> --- gcc/reorg.c.jj 2016-04-26 08:08:16.000000000 +0200
> +++ gcc/reorg.c 2016-04-26 11:13:53.212030471 +0200
> @@ -1428,7 +1428,7 @@ try_merge_delay_insns (rtx_insn *insn, r
>
> INSN_ANNULLED_BRANCH_P (delay_insn) = 0;
>
> - for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
> + for (int i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
> INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) = 0;
> }
> }
Can you make all for statements declare their i as int and remove the
outer declaration?
Bernd
More information about the Gcc-patches
mailing list