Integrated: JDK-8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior

Tobias Holenstein tholenstein at openjdk.org
Fri Feb 17 14:46:54 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.

This pull request has now been integrated.

Changeset: cd77fcfb
Author:    Tobias Holenstein <tholenstein at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/cd77fcfb5f9156e5f0909fa15a842dde6c25c66a
Stats:     2 lines in 1 file changed: 0 ins; 0 del; 2 mod

8290822: C2: assert in PhaseIdealLoop::do_unroll() is subject to undefined behavior

Reviewed-by: kvn, thartmann

-------------

PR: https://git.openjdk.org/jdk/pull/12576


More information about the hotspot-compiler-dev mailing list