diff mbox

Avoid -Wsign-compare warning

Message ID 20121213124538.GR2315@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Dec. 13, 2012, 12:45 p.m. UTC
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

Comments

Richard Biener Dec. 13, 2012, 1:08 p.m. UTC | #1
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
diff mbox

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
 		{