RFR(S): 8203196: C1 emits incorrect code due to integer overflow in _tableswitch keys
tobias.hartmann at oracle.com
Fri May 18 11:56:58 UTC 2018
On 18.05.2018 13:52, Lindenmaier, Goetz wrote:
> The fix looks good. I will push it through our nightly testing.
> I can check the results only on Tuesday due to the holiday ☹
Thanks! I've already verified with the failing JCK tests but additional testing is always good.
>> -----Original Message-----
>> From: hotspot-compiler-dev <hotspot-compiler-dev-
>> bounces at openjdk.java.net> On Behalf Of Tobias Hartmann
>> Sent: Friday, May 18, 2018 12:03 PM
>> To: hotspot compiler <hotspot-compiler-dev at openjdk.java.net>
>> Subject:  RFR(S): 8203196: C1 emits incorrect code due to integer
>> overflow in _tableswitch keys
>> please review the following patch:
>> C1 incorrectly compiles a _tableswitch instruction due to an integer overflow
>> of x->hi_key() in
>> 0 0 i5 2147483647
>> . 2 0 6 tableswitch i5
>> case 2147483647: B1
>> default : B2
>> canonicalized to:
>> . 2 0 7 goto B2
>> We compute hi_key = _lo_key + length() - 1 = INT_MAX + (2 - 1) - 1 =
>> INT_MAX + 1 - 1 which may
>> overflow depending on how the C++ compiler translates it (fails with
>> fastdebug, works with
>> slowdebug). I've added parentheses and an assert for sanity checking.
>> This problem was introduced by the fix for JDK-8200303. Before, we would
>> use an if instead of a
>> switch .
>>  http://hg.openjdk.java.net/jdk/jdk/rev/d84f06a0cae1#l3.8
More information about the hotspot-compiler-dev