On Fri, 16 Oct 2026 11:54:38 GMT, Jorn Vernee <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/foreign/Linker.java line 372:
>> 
>>> 370:  *     MemorySegment array = arena.allocateFrom(C_INT, 0, 9, 3, 4, 6, 
>>> 5, 1, 8, 2, 7);
>>> 371:  *     qsort.invokeExact(array, 10L, 4L, comparFunc);
>>> 372:  *     int[] sorted = array.toArray(ValueLayout.JAVA_INT); // [ 0, 1, 
>>> 2, 3, 4, 5, 6, 7, 8, 9 ]
>> 
>> This is a bit subtle -- but I think it's ok
>
> Actually, after double-checking the javadoc, the layout passed to `toArray` 
> is the source element layout, so this should be `C_INT` as well.

Fixed in: 
https://github.com/openjdk/jdk/pull/33411/changes/dd9d89e9aadc238e462830b6210e2a473ccf1ec2

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33411#discussion_r4294641919

Reply via email to