-
Bug
-
Resolution: Fixed
-
P4
-
19
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
Debian i386 | armhf OpenJDK 19
A DESCRIPTION OF THE PROBLEM :
storing a MemoryAddress.ofLong(0x0000000080000000L) via MemorySegmen.set(ValueLayout.ADDRESS, offset, value) and retriving it via MemorySegmen.set(ValueLayout.ADDRESS, offset) both memory addresses are not equal because of the expanded sign in the retrieved value.
Both memory addresses point to the same location one with 0x0000000080000000L and the other with 0xffffffff80000000L the upper 4 bytes are ignored ...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
just run the source code provided
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
either both memory addresses have the value 0xffffffff80000000L or the upper half of the value is ignored on 32 bit pointer platforms.
ACTUAL -
test fails
---------- BEGIN SOURCE ----------
@Test
public void testGetAtIndex_32BitAddress() {
try (MemorySession ms = MemorySession.openConfined()) {
MemorySegment pointerArray = MemorySegment.allocateNative(128, ms);
MemoryAddress expected = MemoryAddress.ofLong(0x0000000080000000L);
pointerArray.setAtIndex(ValueLayout.ADDRESS, 0, expected);
MemoryAddress actual = pointerArray.getAtIndex(ValueLayout.ADDRESS, 0);
Assertions.assertEquals(expected, actual);
}
}
@Test
public void testGet_32BitAddress() {
try (MemorySession ms = MemorySession.openConfined()) {
MemorySegment pointerArray = MemorySegment.allocateNative(128, ms);
MemoryAddress expected = MemoryAddress.ofLong(0x0000000080000000L);
pointerArray.set(ValueLayout.ADDRESS, 0, expected);
MemoryAddress actual = pointerArray.get(ValueLayout.ADDRESS, 0);
Assertions.assertEquals(expected, actual);
}
}
---------- END SOURCE ----------
FREQUENCY : always
Debian i386 | armhf OpenJDK 19
A DESCRIPTION OF THE PROBLEM :
storing a MemoryAddress.ofLong(0x0000000080000000L) via MemorySegmen.set(ValueLayout.ADDRESS, offset, value) and retriving it via MemorySegmen.set(ValueLayout.ADDRESS, offset) both memory addresses are not equal because of the expanded sign in the retrieved value.
Both memory addresses point to the same location one with 0x0000000080000000L and the other with 0xffffffff80000000L the upper 4 bytes are ignored ...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
just run the source code provided
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
either both memory addresses have the value 0xffffffff80000000L or the upper half of the value is ignored on 32 bit pointer platforms.
ACTUAL -
test fails
---------- BEGIN SOURCE ----------
@Test
public void testGetAtIndex_32BitAddress() {
try (MemorySession ms = MemorySession.openConfined()) {
MemorySegment pointerArray = MemorySegment.allocateNative(128, ms);
MemoryAddress expected = MemoryAddress.ofLong(0x0000000080000000L);
pointerArray.setAtIndex(ValueLayout.ADDRESS, 0, expected);
MemoryAddress actual = pointerArray.getAtIndex(ValueLayout.ADDRESS, 0);
Assertions.assertEquals(expected, actual);
}
}
@Test
public void testGet_32BitAddress() {
try (MemorySession ms = MemorySession.openConfined()) {
MemorySegment pointerArray = MemorySegment.allocateNative(128, ms);
MemoryAddress expected = MemoryAddress.ofLong(0x0000000080000000L);
pointerArray.set(ValueLayout.ADDRESS, 0, expected);
MemoryAddress actual = pointerArray.get(ValueLayout.ADDRESS, 0);
Assertions.assertEquals(expected, actual);
}
}
---------- END SOURCE ----------
FREQUENCY : always