public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rl78.c: fix warning
@ 2016-06-01 19:50 David Malcolm
  2016-06-01 20:34 ` DJ Delorie
  0 siblings, 1 reply; 2+ messages in thread
From: David Malcolm @ 2016-06-01 19:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: DJ Delorie, David Malcolm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] rl78.c: fix warning
  2016-06-01 19:50 [PATCH] rl78.c: fix warning David Malcolm
@ 2016-06-01 20:34 ` DJ Delorie
  0 siblings, 0 replies; 2+ messages in thread
From: DJ Delorie @ 2016-06-01 20:34 UTC (permalink / raw)
  To: David Malcolm; +Cc: gcc-patches


David Malcolm <dmalcolm@redhat.com> writes:
> gcc/ChangeLog:
> 	* config/rl78/rl78.c (rl78_expand_prologue): Convert local
> 	from int to unsigned.

Ok.  I'm going to note that the corresponding loop in the epilogue also
uses signed, but in that case, it must.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-01 20:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-01 19:50 [PATCH] rl78.c: fix warning David Malcolm
2016-06-01 20:34 ` DJ Delorie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).