Integrated: 8347426: Invalid value used for enum Cell in iTypeFlow::StateVector::meet_exception

Marc Chevalier duke at openjdk.org
Thu Feb 27 18:10:01 UTC 2025


On Tue, 25 Feb 2025 10:11:54 GMT, Marc Chevalier <duke at openjdk.org> wrote:

> As guess on the JBS ticket, we have a UB when `_outer->max_locals() == 0`, because then we try to do `(Cell)(-1)` which is out of range since Cell's range is [0, `INT_MAX`].
> 
> The obvious fix that is
> 
> Cell limit = local(_outer->max_locals());
> for (Cell c = start_cell(); c < limit; c = next_cell(c)) {
> 
> since `local` asserts its argument to be in [0, `outer->max_locals()`). Of course
> 
> Cell limit = (Cell)(_outer->max_locals());
> 
> would work, but it seems to break (the very light) abstraction.
> 
> I've also added an assert to transform the UB into a clear failure.
> 
> This fix makes the UB warning go away on Mac with arm64.
> 
> Thanks,
> Marc

This pull request has now been integrated.

Changeset: 2fd71561
Author:    Marc Chevalier <marc.chevalier at oracle.com>
Committer: Vladimir Kozlov <kvn at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2fd71561107a5226f44e1732b646e43a82566eb3
Stats:     5 lines in 2 files changed: 3 ins; 0 del; 2 mod

8347426: Invalid value used for enum Cell in iTypeFlow::StateVector::meet_exception

Reviewed-by: dlong, kvn

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

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


More information about the hotspot-compiler-dev mailing list