< prev index next >

src/share/vm/opto/type.cpp

Print this page
@  rev 8243 : 8078666: JVM fastdebug build compiled with GCC 5 asserts with "widen increases"
|  Summary: Fix signed integer overflow in normalize_{int,long}_widen()

@@ -1156,15 +1156,15 @@
 
 static int normalize_int_widen( jint lo, jint hi, int w ) {
   // Certain normalizations keep us sane when comparing types.
   // The 'SMALLINT' covers constants and also CC and its relatives.
   if (lo <= hi) {
-    if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
-    if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
+    if ((juint)hi - lo <= SMALLINT)  w = Type::WidenMin;
+    if ((juint)hi - lo >= max_juint) w = Type::WidenMax; // TypeInt::INT
   } else {
-    if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
-    if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
+    if ((juint)lo - hi <= SMALLINT)  w = Type::WidenMin;
+    if ((juint)lo - hi >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
   }
   return w;
 }
 
 const TypeInt *TypeInt::make( jint lo, jint hi, int w ) {

@@ -1414,15 +1414,15 @@
 
 static int normalize_long_widen( jlong lo, jlong hi, int w ) {
   // Certain normalizations keep us sane when comparing types.
   // The 'SMALLINT' covers constants.
   if (lo <= hi) {
-    if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
-    if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
+    if ((julong)hi - lo <= SMALLINT)   w = Type::WidenMin;
+    if ((julong)hi - lo >= max_julong) w = Type::WidenMax; // TypeLong::LONG
   } else {
-    if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
-    if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
+    if ((julong)lo - hi <= SMALLINT)   w = Type::WidenMin;
+    if ((julong)lo - hi >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
   }
   return w;
 }
 
 const TypeLong *TypeLong::make( jlong lo, jlong hi, int w ) {
< prev index next >