RFR: JDK-8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior
Tobias Hartmann
thartmann at openjdk.org
Fri Feb 17 06:18:15 UTC 2023
On Wed, 15 Feb 2023 16:13:21 GMT, Tobias Holenstein <tholenstein 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 to me too.
-------------
Marked as reviewed by thartmann (Reviewer).
PR: https://git.openjdk.org/jdk/pull/12576
More information about the hotspot-compiler-dev
mailing list