This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] rl78.c: fix warning
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: DJ Delorie <dj at redhat dot com>, David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 1 Jun 2016 16:16:19 -0400
- Subject: [PATCH] rl78.c: fix warning
- Authentication-results: sourceware.org; auth=none
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