8078666: JVM fastdebug build compiled with GCC 5 asserts with "widen increases"

Wed, 29 Apr 2015 12:23:48 -0700

author
sgehwolf
date
Wed, 29 Apr 2015 12:23:48 -0700
changeset 7873
2a55e4998f0d
parent 7872
cd8fe1a9205a
child 7874
908b2d7253fc

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 file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/opto/type.cpp	Wed Jun 10 20:15:29 2015 -0400
     1.2 +++ b/src/share/vm/opto/type.cpp	Wed Apr 29 12:23:48 2015 -0700
     1.3 @@ -1180,11 +1180,11 @@
     1.4    // Certain normalizations keep us sane when comparing types.
     1.5    // The 'SMALLINT' covers constants and also CC and its relatives.
     1.6    if (lo <= hi) {
     1.7 -    if ((juint)(hi - lo) <= SMALLINT)  w = Type::WidenMin;
     1.8 -    if ((juint)(hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
     1.9 +    if (((juint)hi - lo) <= SMALLINT)  w = Type::WidenMin;
    1.10 +    if (((juint)hi - lo) >= max_juint) w = Type::WidenMax; // TypeInt::INT
    1.11    } else {
    1.12 -    if ((juint)(lo - hi) <= SMALLINT)  w = Type::WidenMin;
    1.13 -    if ((juint)(lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
    1.14 +    if (((juint)lo - hi) <= SMALLINT)  w = Type::WidenMin;
    1.15 +    if (((juint)lo - hi) >= max_juint) w = Type::WidenMin; // dual TypeInt::INT
    1.16    }
    1.17    return w;
    1.18  }
    1.19 @@ -1438,11 +1438,11 @@
    1.20    // Certain normalizations keep us sane when comparing types.
    1.21    // The 'SMALLINT' covers constants.
    1.22    if (lo <= hi) {
    1.23 -    if ((julong)(hi - lo) <= SMALLINT)   w = Type::WidenMin;
    1.24 -    if ((julong)(hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
    1.25 +    if (((julong)hi - lo) <= SMALLINT)   w = Type::WidenMin;
    1.26 +    if (((julong)hi - lo) >= max_julong) w = Type::WidenMax; // TypeLong::LONG
    1.27    } else {
    1.28 -    if ((julong)(lo - hi) <= SMALLINT)   w = Type::WidenMin;
    1.29 -    if ((julong)(lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
    1.30 +    if (((julong)lo - hi) <= SMALLINT)   w = Type::WidenMin;
    1.31 +    if (((julong)lo - hi) >= max_julong) w = Type::WidenMin; // dual TypeLong::LONG
    1.32    }
    1.33    return w;
    1.34  }

mercurial