diff mbox

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

Message ID 20031.43997.941589.223641@pilspetsen.it.uu.se
State New
Headers show

Commit Message

Mikael Pettersson Aug. 8, 2011, 9:26 a.m. UTC
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.
diff mbox

Patch

--- 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