Hi!

I've noticed a warning during bootstrap:
../../gcc/reorg.c: In function ‘void try_merge_delay_insns(rtx_insn*, 
rtx_insn*)’:
../../gcc/reorg.c:1431:12: warning: name lookup of ‘i’ changed
       for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++)
            ^
../../gcc/reorg.c:1263:7: warning:   matches this ‘i’ under ISO standard rules
   int i, j;
       ^
../../gcc/reorg.c:1413:25: warning:   matches this ‘i’ under old rules
       for (unsigned int i = len - 1; i < len; i--)
                         ^
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  <ja...@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;
     }
 }

        Jakub

Reply via email to