--- old/src/hotspot/share/c1/c1_Instruction.hpp 2018-05-18 11:53:03.029469565 +0200 +++ new/src/hotspot/share/c1/c1_Instruction.hpp 2018-05-18 11:53:02.853469567 +0200 @@ -2122,11 +2122,11 @@ // creation TableSwitch(Value tag, BlockList* sux, int lo_key, ValueStack* state_before, bool is_safepoint) : Switch(tag, sux, state_before, is_safepoint) - , _lo_key(lo_key) {} + , _lo_key(lo_key) { assert(_lo_key <= hi_key(), "integer overflow"); } // accessors int lo_key() const { return _lo_key; } - int hi_key() const { return _lo_key + length() - 1; } + int hi_key() const { return _lo_key + (length() - 1); } }; --- old/src/hotspot/share/c1/c1_LIRGenerator.cpp 2018-05-18 11:53:03.985469552 +0200 +++ new/src/hotspot/share/c1/c1_LIRGenerator.cpp 2018-05-18 11:53:03.665469556 +0200 @@ -2304,8 +2304,8 @@ move_to_phi(x->state()); int lo_key = x->lo_key(); - int hi_key = x->hi_key(); int len = x->length(); + assert(lo_key <= (lo_key + (len - 1)), "integer overflow"); LIR_Opr value = tag.result(); if (compilation()->env()->comp_level() == CompLevel_full_profile && UseSwitchProfiling) {