From 64e4aa21a42688f8b2095a609e20f05af7672ca4 Mon Sep 17 00:00:00 2001 From: Andrew Haley Date: Fri, 22 Nov 2024 12:09:30 +0000 Subject: [PATCH] 8339916: AIOOBE due to Math.abs(Integer.MIN_VALUE) in tests Reviewed-by: shade --- test/micro/org/openjdk/bench/vm/lang/TypePollution.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/micro/org/openjdk/bench/vm/lang/TypePollution.java b/test/micro/org/openjdk/bench/vm/lang/TypePollution.java index 4994bcf9c2d..94c00d60b33 100644 --- a/test/micro/org/openjdk/bench/vm/lang/TypePollution.java +++ b/test/micro/org/openjdk/bench/vm/lang/TypePollution.java @@ -178,7 +178,7 @@ public class TypePollution { probe ^= probe << 13; // xorshift probe ^= probe >>> 17; probe ^= probe << 5; - dummy += switch(objectArray[Math.abs(probe) % objectArray.length]) { + dummy += switch(objectArray[(probe & Integer.MAX_VALUE) % objectArray.length]) { case I01 inst -> 1; case I02 inst -> 2; case I03 inst -> 3; @@ -192,7 +192,7 @@ public class TypePollution { probe ^= probe << 13; // xorshift probe ^= probe >>> 17; probe ^= probe << 5; - dummy += switch(objectArray[Math.abs(probe) % objectArray.length]) { + dummy += switch(objectArray[(probe & Integer.MAX_VALUE) % objectArray.length]) { case I18 inst -> 8; case I17 inst -> 7; case I16 inst -> 6;