Remove remaining signed/unsigned comparison error messages when compiling.
authorMario de Sousa <msousa@fe.up.pt>
Thu, 16 Aug 2012 18:28:23 +0100
changeset 621 e3616f6b6959
parent 620 aef32856eeb5
child 622 eaa49b276e17
Remove remaining signed/unsigned comparison error messages when compiling.
stage3/array_range_check.cc
stage3/constant_folding.cc
--- a/stage3/array_range_check.cc	Fri Jul 20 23:18:32 2012 +0200
+++ b/stage3/array_range_check.cc	Thu Aug 16 18:28:23 2012 +0100
@@ -80,7 +80,8 @@
  *    first has a lesser value.
  */
 static inline int cmp_unsigned_signed(const uint64_t u, const int64_t s) {
-  if (u <= INT64_MAX)
+  const uint64_t INT64_MAX_uvar = INT64_MAX;
+  if (u <= INT64_MAX_uvar)
     return ((int64_t)u - s);
   return -1;
 }
--- a/stage3/constant_folding.cc	Fri Jul 20 23:18:32 2012 +0200
+++ b/stage3/constant_folding.cc	Thu Aug 16 18:28:23 2012 +0100
@@ -752,7 +752,7 @@
 	 * However, the positive value cannot be stored inside an int64! So, in this case, we will get the value from the uint64 cvalue.
 	 */
 	// if (INT64_MIN == -INT64_MAX - 1) // We do not really need to check that the platform uses two's complement
-	if (VALID_CVALUE(uint64, symbol->exp) && (GET_CVALUE(uint64, symbol->exp) == -INT64_MIN)) { // How do we stop the compiler from complaining about a comparison between int and unsigned int?
+	if (VALID_CVALUE(uint64, symbol->exp) && (GET_CVALUE(uint64, symbol->exp) == (uint64_t)INT64_MAX+1)) {
 		SET_CVALUE(int64, symbol, INT64_MIN);
 	}
 	return NULL;