[PATCH] rl78.c: fix warning

David Malcolm dmalcolm@redhat.com
Wed Jun 1 19:50:00 GMT 2016


This configuration in contrib/config-list.mk
  rl78-elf
currently fails to build due to a warning:

gcc/config/rl78/rl78.c: In function ‘void rl78_expand_prologue()’:
gcc/config/rl78/rl78.c:1381:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
       for (int i = 0; i < ARRAY_SIZE (mduc_regs); i++)
                         ^
(tested with compiling trunk using gcc 6 via
contrib/config-list.mk).

OK for trunk?  (I've only verified that it compiles and fixes the
warning; I haven't tested the results).

gcc/ChangeLog:
	* config/rl78/rl78.c (rl78_expand_prologue): Convert local
	from int to unsigned.
---
 gcc/config/rl78/rl78.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/rl78/rl78.c b/gcc/config/rl78/rl78.c
index 2d85061..3ddb198 100644
--- a/gcc/config/rl78/rl78.c
+++ b/gcc/config/rl78/rl78.c
@@ -1378,7 +1378,7 @@ rl78_expand_prologue (void)
   /* Save MDUC registers inside interrupt routine.  */
   if (MUST_SAVE_MDUC_REGISTERS && (!crtl->is_leaf || check_mduc_usage ()))
     {
-      for (int i = 0; i < ARRAY_SIZE (mduc_regs); i++)
+      for (unsigned i = 0; i < ARRAY_SIZE (mduc_regs); i++)
         {
           mduc_reg_type *reg = mduc_regs + i;
           rtx mem_mduc = gen_rtx_MEM (reg->mode, GEN_INT (reg->address));
-- 
1.8.5.3



More information about the Gcc-patches mailing list