RFR: JDK-8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior
Tobias Holenstein
tholenstein at openjdk.org
Fri Feb 17 14:46:53 UTC 2023
On Thu, 16 Feb 2023 18:11:00 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> The following assert had undefined behavior (UB) because of _signed_ integer underflow/overflow:
>>
>> assert(stride_con > 0 && ((limit_type->_hi - stride_con) < limit_type->_hi) ||
>> stride_con < 0 && ((limit_type->_lo - stride_con) > limit_type->_lo),
>> "sanity");
>>
>>
>> # Solution
>> The fix is to check for underflow/overflow (the purpose of the assert) without actually underflowing/overflowing.
>
> Looks good.
thanks @vnkozlov and @TobiHartmann !
-------------
PR: https://git.openjdk.org/jdk/pull/12576
More information about the hotspot-compiler-dev
mailing list