JDK-8308992 : New test TestHFA fails with zero
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.foreign
  • Affected Version: 21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-05-28
  • Updated: 2023-06-05
  • Resolved: 2023-05-30
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 21
21 b25Fixed
Related Reports
Relates :  
Description
----------System.out:(56/3121)----------
S_FF(2.0;1.0)
test TestHFA.testAddDoubleToStructAfterStructs(): success
S_FF(2.0;1.0)
test TestHFA.testAddDoubleToStructAfterStructsUpcall(): success
S_FFFFFFF(2.0;4.0;6.0;8.0;10.0;12.0;14.0)
test TestHFA.testAddFloatStructs(): success
S_FFFFFFF(2.0;4.0;6.0;8.0;10.0;12.0;14.0)
test TestHFA.testAddFloatStructsUpcall(): success
test TestHFA.testAddFloatToLargeStructAfterStructs(): failure
java.lang.RuntimeException: add_float_to_large_struct_after_structs error
	at TestHFA.testAddFloatToLargeStructAfterStructs(TestHFA.java:231)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1593)
	at org.testng.TestRunner.privateRun(TestRunner.java:764)
	at org.testng.TestRunner.run(TestRunner.java:585)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
	at org.testng.SuiteRunner.run(SuiteRunner.java:286)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
	at org.testng.TestNG.runSuites(TestNG.java:1069)
	at org.testng.TestNG.run(TestNG.java:1037)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1583)
S_FFFFFFF(2.0;2.0;3.0;4.0;5.0;6.0;7.0)
test TestHFA.testAddFloatToLargeStructAfterStructsUpcall(): success
S_FF(2.0;1.0)
test TestHFA.testAddFloatToStructAfterFloats(): success
S_FF(2.0;1.0)
test TestHFA.testAddFloatToStructAfterFloatsUpcall(): success
S_FF(2.0;1.0)
test TestHFA.testAddFloatToStructAfterStructs(): success
S_FF(2.0;1.0)
test TestHFA.testAddFloatToStructAfterStructsUpcall(): success

===============================================
java/foreign/TestHFA.java
Total tests run: 10, Passes: 9, Failures: 1, Skips: 0
===============================================

----------System.err:(57/4250)----------
java.lang.IndexOutOfBoundsException: Out of bound access on segment MemorySegment{ heapBase: Optional.empty address:139671398751904 limit: 8 }; new offset = 0; new length = 28
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.outOfBoundException(AbstractMemorySegmentImpl.java:424)
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.apply(AbstractMemorySegmentImpl.java:405)
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.apply(AbstractMemorySegmentImpl.java:69)
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:124)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:448)
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.checkBounds(AbstractMemorySegmentImpl.java:394)
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.checkAccess(AbstractMemorySegmentImpl.java:354)
	at java.base/jdk.internal.foreign.AbstractMemorySegmentImpl.copy(AbstractMemorySegmentImpl.java:611)
	at java.base/java.lang.foreign.MemorySegment.copy(MemorySegment.java:1332)
	at java.base/java.lang.foreign.MemorySegment.copy(MemorySegment.java:1279)
	at java.base/java.lang.foreign.MemorySegment.copyFrom(MemorySegment.java:804)
	at java.base/jdk.internal.foreign.abi.fallback.FallbackLinker.writeValue(FallbackLinker.java:247)
	at java.base/jdk.internal.foreign.abi.fallback.FallbackLinker.doDowncall(FallbackLinker.java:167)
	at TestHFA.testAddFloatToLargeStructAfterStructs(TestHFA.java:216)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
	at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1593)
	at org.testng.TestRunner.privateRun(TestRunner.java:764)
	at org.testng.TestRunner.run(TestRunner.java:585)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
	at org.testng.SuiteRunner.run(SuiteRunner.java:286)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
	at org.testng.TestNG.runSuites(TestNG.java:1069)
	at org.testng.TestNG.run(TestNG.java:1037)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:102)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1583)
java.lang.Exception: failures: 1
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:104)
	at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:58)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Comments
The fix for this bug is integrated in jdk-21+25-2172.
30-05-2023

Changeset: 804f198c Author: Jorn Vernee <jvernee@openjdk.org> Date: 2023-05-30 15:28:40 +0000 URL: https://git.openjdk.org/jdk/commit/804f198c73794ffce34a8a10c255656c25cf6d79
30-05-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/14215 Date: 2023-05-30 12:17:00 +0000
30-05-2023