Skip to content

Commit 5c889be

Browse files
[GITHUB-1118] Fix mixed union with double and int members also on arm/aarch64
1 parent 4bc4b88 commit 5c889be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/com/sun/jna/Structure.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -2047,14 +2047,20 @@ public FFIType(Structure ref) {
20472047
size = sf.size;
20482048
}
20492049
}
2050-
if((! Platform.isWindows()) && Platform.isIntel() && Platform.is64Bit()) {
2050+
if( (! Platform.isWindows()) && (
2051+
(Platform.isIntel() && Platform.is64Bit())
2052+
|| (Platform.isARM())
2053+
)) {
20512054
// System V x86-64 ABI requires, that in a union aggregate,
20522055
// that contains Integer and Double members, the parameters
20532056
// must be passed in the integer registers. I.e. in the case
20542057
// where the java side declares double and int members, the
20552058
// wrong FFI Type would be found, because the doubles size
20562059
// is larger than the int member, but the wrong parameter
20572060
// passing method would be used.
2061+
//
2062+
// It was observed, that the same behaviour is visible on
2063+
// arm/aarch64.
20582064
if(hasInteger && isFloatType(unionType)) {
20592065
unionType = new FFIType(unionType);
20602066
if(unionType.size.intValue() == 4) {

0 commit comments

Comments
 (0)