Patchwork Fix a -Wsign-compare warning in i386.c

login
register
mail settings
Submitter Jakub Jelinek
Date April 26, 2013, 10:23 p.m.
Message ID <20130426222318.GV28963@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/240056/
State New
Headers show

Comments

Jakub Jelinek - April 26, 2013, 10:23 p.m.
Hi!

GCC 4.7.2 warns about -Wsign-compare when unsigned iterator is compared
with cregs_size.  GCC 4.8 doesn't warn about it (otherwise bootstrap would
fail), because it calls maybe_constant_value before emitting the warning,
but still I'd say it is better to use the same signedness.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2013-04-26  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/i386.c (ix86_expand_call): Make cregs_size unsigned.


	Jakub
Uros Bizjak - April 27, 2013, 8:33 a.m.
On Sat, Apr 27, 2013 at 12:23 AM, Jakub Jelinek <jakub@redhat.com> wrote:

> GCC 4.7.2 warns about -Wsign-compare when unsigned iterator is compared
> with cregs_size.  GCC 4.8 doesn't warn about it (otherwise bootstrap would
> fail), because it calls maybe_constant_value before emitting the warning,
> but still I'd say it is better to use the same signedness.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2013-04-26  Jakub Jelinek  <jakub@redhat.com>
>
>         * config/i386/i386.c (ix86_expand_call): Make cregs_size unsigned.

OK - even obvious, I'd say.

Thanks,
Uros.

Patch

--- gcc/config/i386/i386.c.jj	2013-04-26 19:11:33.000000000 +0200
+++ gcc/config/i386/i386.c	2013-04-26 19:12:21.329725950 +0200
@@ -23714,7 +23714,8 @@  ix86_expand_call (rtx retval, rtx fnaddr
 		  rtx callarg2,
 		  rtx pop, bool sibcall)
 {
-  int const cregs_size = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
+  unsigned int const cregs_size
+    = ARRAY_SIZE (x86_64_ms_sysv_extra_clobbered_registers);
   rtx vec[3 + cregs_size];
   rtx use = NULL, call;
   unsigned int vec_len = 0;