From 4a70144df356b7023ea901b2326167030f314ce1 Mon Sep 17 00:00:00 2001 From: sgehwolf Date: Wed, 29 Apr 2015 12:23:48 -0700 Subject: [PATCH] 8078666: JVM fastdebug build compiled with GCC 5 asserts with "widen increases" Summary: do the math on the unsigned type where overflows are well defined Reviewed-by: kvn, aph --- src/share/vm/opto/type.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/share/vm/opto/type.cpp b/src/share/vm/opto/type.cpp index 1029aa9ff..e57e23b69 100644 --- a/src/share/vm/opto/type.cpp +++ b/src/share/vm/opto/type.cpp @@ -1180,11 +1180,11 @@ 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; } @@ -1438,11 +1438,11 @@ 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; } -- GitLab