From 30abe0b3a6ee2d9a8ef992e58e8e81d5aadaf49f Mon Sep 17 00:00:00 2001 From: Vladimir Ivanov Date: Mon, 13 Jul 2026 17:51:11 +0000 Subject: [PATCH] 8373487: Out-of-bounds access in AlignmentGapAccess test Reviewed-by: dlong, ayang --- test/hotspot/jtreg/ProblemList.txt | 2 -- test/hotspot/jtreg/compiler/unsafe/AlignmentGapAccess.java | 7 ++++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index e0005bfde07..0a98477be69 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -67,8 +67,6 @@ compiler/interpreter/Test6833129.java 8335266 generic-i586 compiler/c2/aarch64/TestStaticCallStub.java 8359963 generic-aarch64 -compiler/unsafe/AlignmentGapAccess.java 8373487 generic-all - compiler/escapeAnalysis/TestBCEscapeAnalyzerOverflow.java 8387392 windows-aarch64 ############################################################################# diff --git a/test/hotspot/jtreg/compiler/unsafe/AlignmentGapAccess.java b/test/hotspot/jtreg/compiler/unsafe/AlignmentGapAccess.java index ac3c4b0278a..8b2ee067140 100644 --- a/test/hotspot/jtreg/compiler/unsafe/AlignmentGapAccess.java +++ b/test/hotspot/jtreg/compiler/unsafe/AlignmentGapAccess.java @@ -38,17 +38,22 @@ public class AlignmentGapAccess { static class A { int fa; } static class B extends A { byte fb; } + static class C extends B { int fc; } static final long FA_OFFSET = UNSAFE.objectFieldOffset(A.class, "fa"); static final long FB_OFFSET = UNSAFE.objectFieldOffset(B.class, "fb"); + static final long FC_OFFSET = UNSAFE.objectFieldOffset(C.class, "fc"); static int test(B obj) { return UNSAFE.getInt(obj, FB_OFFSET + 1); } public static void main(String[] args) { + System.out.printf("Layout: +%d: fa; +%d: fb; +%d: fc\n", + FA_OFFSET, FB_OFFSET, FC_OFFSET); + for (int i = 0; i < 20_000; i++) { - test(new B()); + test(new C()); } System.out.println("TEST PASSED"); }