RFR: 8344104: TestMergeStores fails with ArrayIndexOutOfBoundException

Emanuel Peter epeter at openjdk.org
Thu Nov 14 07:05:59 UTC 2024


On Wed, 13 Nov 2024 15:34:07 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

> Test-bug: `RANDOM.nextInt()` would occasionally return a `min_int`. And sadly this overflows: `Math.abs(min_int) == min_int`. Wen we calculate it `% 100`, it still gives us a negative value, and we end up out of bounds. Fixed with a mask.

> `Math.abs(Integer.MIN_VALUE)` strikes _AGAIN_, it is a tremendous fun every time. Why not just `RANDOM.nextInt(100)`?

Yeah, I thought of that too when falling asleep yesterday 😄

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

PR Comment: https://git.openjdk.org/jdk/pull/22080#issuecomment-2475560590


More information about the hotspot-compiler-dev mailing list