JDK-8344104 : TestMergeStores fails with ArrayIndexOutOfBoundException
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2024-11-13
  • Updated: 2024-11-15
  • Resolved: 2024-11-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 masterFixed
Related Reports
Relates :  
Description
compiler/c2/TestMergeStores.java#id0 test fails.  Looks like LockingMode=1 for each of the failures in other tasks.

Error Output
------------
Java HotSpot(TM) 64-Bit Server VM warning: Option LockingMode was deprecated in version 24.0 and will likely be removed in a future release.
Exception in thread "main" compiler.lib.ir_framework.shared.TestRunException: 

Test Failures (1)
-----------------
Custom Run Test: @Run: runTests - @Tests: {test1a,test1b,test1c,test1d,test1e,test1f,test1g,test1h,test1i,test2a,test2b,test2c,test2d,test2e,test2aBE,test2bBE,test2cBE,test2dBE,test2eBE,test3a,test3aBE,test4a,test4aBE,test5a,test6a,test7a,test10a,test10b,test10c,test10d,test10e,test10f,test7aBE,test100a,test101a,test102a,test102aBE,test200a,test201a,test202a,test202aBE,test300a,test400a,test500a,test501a,test502a,test500aBE,test501aBE,test502aBE,test600a,test601a,test700a,test800a,test800aBE}:
compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Run method public void compiler.c2.TestMergeStores.runTests(compiler.lib.ir_framework.RunInfo)
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:162)
	at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:98)
	at compiler.lib.ir_framework.test.CustomRunTest.run(CustomRunTest.java:89)
	at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:861)
	at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:252)
	at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:165)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at compiler.lib.ir_framework.test.CustomRunTest.invokeTest(CustomRunTest.java:157)
	... 5 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -42 out of bounds for length 1000
	at compiler.c2.TestMergeStores.test6R(TestMergeStores.java:1093)
	at compiler.c2.TestMergeStores.lambda$new$32(TestMergeStores.java:157)
	at compiler.c2.TestMergeStores.runTests(TestMergeStores.java:363)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 7 more
Comments
Changeset: 21966942 Branch: master Author: Emanuel Peter <epeter@openjdk.org> Date: 2024-11-15 07:31:55 +0000 URL: https://git.openjdk.org/jdk/commit/21966942b6b5341d0d221d10c3eaa629e543d017
15-11-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/22080 Date: 2024-11-13 15:34:07 +0000
13-11-2024

Ah, good catch Emanuel! Quite nice that it's 42 :D Updated ILW = Test bug, intermittent with single test, no workaround = MLH = P4
13-11-2024

Sorry if this is a duplicate of another problem, I couldn't find it when I looked.
13-11-2024

[~coleenp] thanks for filing this. I suspect it is an overflow in these lines: test/hotspot/jtreg/compiler/c2/TestMergeStores.java: offset1 = Math.abs(RANDOM.nextInt()) % 100; test/hotspot/jtreg/compiler/c2/TestMergeStores.java: offset2 = Math.abs(RANDOM.nextInt()) % 100; when the random value is min_int, abs(min_int) = min_int. min_int % 100 = -42 ... so that looks accurate.
13-11-2024

Emanuel, please have a look.
13-11-2024

ILW = Incorrect result of C2 compiled code, intermittent with single test, -XX:-MergeStores = HML = P2
13-11-2024