Skip to content

Commit ae4631e

Browse files
dcharkescommit-bot@chromium.org
authored andcommitted
[vm/ffi] Fix test sizeOf struct on arm32
Bug introduced in https://dart-review.googlesource.com/c/sdk/+/182262. See documentation on alignment in the following places: - pkg/vm/lib/transformations/ffi.dart - runtime/vm/compiler/ffi/abi.cc - runtime/vm/compiler/ffi/native_type.cc Closes: #44835 Change-Id: I114dd4286e559bb230e1ee27ae5cfd8a0b0d2927 Cq-Include-Trybots: luci.dart.try:vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182501 Commit-Queue: Daco Harkes <[email protected]> Reviewed-by: Clement Skau <[email protected]>
1 parent f306f4c commit ae4631e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

tests/ffi/sizeof_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ get is64Bit => 8 == sizeOf<IntPtr>();
1616
void main() async {
1717
if (is32Bit) {
1818
Expect.equals(4, sizeOf<Pointer>());
19-
Expect.equals(20, sizeOf<Coordinate>());
20-
}
21-
if (is64Bit) {
19+
// Struct is 20 bytes on ia32 and arm32-iOS, but 24 bytes on arm32-Android
20+
// and arm32-Linux due to alignment.
21+
Expect.isTrue(20 == sizeOf<Coordinate>() || 24 == sizeOf<Coordinate>());
22+
} else if (is64Bit) {
2223
Expect.equals(8, sizeOf<Pointer>());
2324
Expect.equals(24, sizeOf<Coordinate>());
2425
}

tests/ffi_2/sizeof_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ get is64Bit => 8 == sizeOf<IntPtr>();
1616
void main() async {
1717
if (is32Bit) {
1818
Expect.equals(4, sizeOf<Pointer>());
19-
Expect.equals(20, sizeOf<Coordinate>());
20-
}
21-
if (is64Bit) {
19+
// Struct is 20 bytes on ia32 and arm32-iOS, but 24 bytes on arm32-Android
20+
// and arm32-Linux due to alignment.
21+
Expect.isTrue(20 == sizeOf<Coordinate>() || 24 == sizeOf<Coordinate>());
22+
} else if (is64Bit) {
2223
Expect.equals(8, sizeOf<Pointer>());
2324
Expect.equals(24, sizeOf<Coordinate>());
2425
}

0 commit comments

Comments
 (0)