Patchwork Avoid -Wsign-compare warning

login
register
mail settings
Submitter Jakub Jelinek
Date Dec. 13, 2012, 12:45 p.m.
Message ID <20121213124538.GR2315@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/205824/
State New
Headers show

Comments

Jakub Jelinek - Dec. 13, 2012, 12:45 p.m.
Hi!

I keep seeing a -Wsign-compare warning from GCC 4.7 here,
alloc_count is const int = 16, but length () method returns unsigned.
Perhaps GCC 4.8 folds it to 16 early enough for the -Wsign-compare warning
(might be related to the sizeof changes), but still I think it doesn't hurt
to fix this up.
Changing alloc_count to unsigned would leave to other -Wsign-compare
warnings, because i is signed, ...

Ok for trunk?

2012-12-13  Jakub Jelinek  <jakub@redhat.com>

	* tree-ssa-threadedge.c (propagate_threaded_block_debug_into): Avoid
	-Wsign-compare warning.



	Jakub
Richard Guenther - Dec. 13, 2012, 1:08 p.m.
On Thu, Dec 13, 2012 at 1:45 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> I keep seeing a -Wsign-compare warning from GCC 4.7 here,
> alloc_count is const int = 16, but length () method returns unsigned.
> Perhaps GCC 4.8 folds it to 16 early enough for the -Wsign-compare warning
> (might be related to the sizeof changes), but still I think it doesn't hurt
> to fix this up.
> Changing alloc_count to unsigned would leave to other -Wsign-compare
> warnings, because i is signed, ...
>
> Ok for trunk?

Ok.

Thanks,
Richard.

> 2012-12-13  Jakub Jelinek  <jakub@redhat.com>
>
>         * tree-ssa-threadedge.c (propagate_threaded_block_debug_into): Avoid
>         -Wsign-compare warning.
>
> --- gcc/tree-ssa-threadedge.c   (revision 194469)
> +++ gcc/tree-ssa-threadedge.c   (working copy)
> @@ -713,7 +713,7 @@ propagate_threaded_block_debug_into (bas
>               if (i >= 0)
>                 continue;
>
> -             if (fewvars.length () < alloc_count)
> +             if (fewvars.length () < (unsigned) alloc_count)
>                 fewvars.quick_push (var);
>               else
>                 {
>
>
>         Jakub

Patch

--- gcc/tree-ssa-threadedge.c	(revision 194469)
+++ gcc/tree-ssa-threadedge.c	(working copy)
@@ -713,7 +713,7 @@  propagate_threaded_block_debug_into (bas
 	      if (i >= 0)
 		continue;
 
-	      if (fewvars.length () < alloc_count)
+	      if (fewvars.length () < (unsigned) alloc_count)
 		fewvars.quick_push (var);
 	      else
 		{