This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,PR50005] fix -Wsign-compare warning in ipa-inline-analysis.c


A recent change in ipa-inline-analysis.c introduced a comparison
between signed and unsigned values, which broke bootstrap due to
-Wsign-compare (PR50005).  Fixed by casting VEC_length to int before
using it in a comparison, as is done in many other places.

Tested on i686-linux and sparc64-linux.  Pre-approved by Jan Hubicka
in the PR trail.

Ok for trunk?  (I don't have svn write access.)

(The warning is only visible with the C FE due to an unrelated C++ FE
diagnostics bug, which I've filed as PR50012.)

/Mikael

gcc/

2011-08-08  Mikael Pettersson  <mikpe@it.uu.se>

	PR tree-optimization/50005
	* ipa-inline-analysis (remap_predicate): Add cast to
	silence signed/unsigned comparison warning.

--- gcc-4.7-20110806/gcc/ipa-inline-analysis.c.~1~	2011-08-05 22:56:05.000000000 +0200
+++ gcc-4.7-20110806/gcc/ipa-inline-analysis.c	2011-08-07 12:15:46.000000000 +0200
@@ -1873,7 +1873,7 @@ remap_predicate (struct inline_summary *
 		 /* See if we can remap condition operand to caller's operand.
 		    Otherwise give up.  */
 		 if (!operand_map
-		     || VEC_length (int, operand_map) <= c->operand_num
+		     || (int)VEC_length (int, operand_map) <= c->operand_num
 		     || VEC_index (int, operand_map, c->operand_num) == -1)
 		   cond_predicate = true_predicate ();
 		 else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]