A patch I have developed for PR 50012 issues a warning for some code in
ipa-cp.c in which a variable of type int is compared to the return value
of VEC_length, which is unsigned int.  This should logically require a
type cast, and actually I'm not sure why the warning is not issued
without my patch.  In any case, this patch adds the required type
casts.  Committed as obvious.

Ian


2012-01-13  Ian Lance Taylor  <i...@google.com>

        * ipa-cp.c (ipa_get_indirect_edge_target): Add typecasts when
        comparing param_index to VEC_length result.


Index: ipa-cp.c
===================================================================
--- ipa-cp.c	(revision 183165)
+++ ipa-cp.c	(working copy)
@@ -1112,7 +1112,7 @@ ipa_get_indirect_edge_target (struct cgr
 
   if (!ie->indirect_info->polymorphic)
     {
-      tree t = (VEC_length (tree, known_vals) > param_index
+      tree t = (VEC_length (tree, known_vals) > (unsigned int) param_index
 	        ? VEC_index (tree, known_vals, param_index) : NULL);
       if (t &&
 	  TREE_CODE (t) == ADDR_EXPR
@@ -1127,7 +1127,8 @@ ipa_get_indirect_edge_target (struct cgr
   otr_type = ie->indirect_info->otr_type;
 
   t = VEC_index (tree, known_vals, param_index);
-  if (!t && known_binfos && VEC_length (tree, known_binfos) > param_index)
+  if (!t && known_binfos
+      && VEC_length (tree, known_binfos) > (unsigned int) param_index)
     t = VEC_index (tree, known_binfos, param_index);
   if (!t)
     return NULL_TREE;

Reply via email to