Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vm/ffi] VarArgs with int32_t broken on Mac Arm64 #55471

Closed
dcharkes opened this issue Apr 15, 2024 · 0 comments
Closed

[vm/ffi] VarArgs with int32_t broken on Mac Arm64 #55471

dcharkes opened this issue Apr 15, 2024 · 0 comments
Assignees
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi P2 A bug or feature request we're likely to work on

Comments

@dcharkes
Copy link
Contributor

@Native<
        Int32 Function(Struct12BytesHomogeneousInt32,
            VarArgs<(Int32, Int32, Int32, Int32)>)>(
    symbol: 'VariadicAt1Struct12BytesHomogeneousInt32Int32x4', isLeaf: true)
external int variadicAt1Struct12BytesHomogeneousInt32Int32x4NativeLeaf(
    Struct12BytesHomogeneousInt32 a0, int a1, int a2, int a3, int a4);
VariadicAt1Struct12BytesHomogeneousInt32Int32x4((-1, 2, -3), 4, 6, 1879942168, 188481260)
result = 2068423436
result = 2068423436
Unhandled exception:
Expect.equals(expected: <-4>, actual: <2068423436>) fails.
#0      Expect._fail (package:expect/expect.dart:722:5)
#1      Expect.equals (package:expect/expect.dart:125:5)
#2      testVariadicAt1Struct12BytesHomogeneousInt32Int32x4NativeLeaf (file:///Users/dacoharkes/dart-sdk/sdk/tests/ffi/function_varargs_generated_native_leaf_test.dart:832:10)
#3      main (file:///Users/dacoharkes/dart-sdk/sdk/tests/ffi/function_varargs_generated_native_leaf_test.dart:48:5)
#4      _delayEntrypointInvocation.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:297:19)
#5      _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)

The varargs are mangled:

  • The first argument seems correct.
  • The 3rd argument is in the position where the second arg is expected.
  • The 3rd and 4th argument position contain garbage.

Thanks for reporting @HosseinYousefi

@dcharkes dcharkes added area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. P2 A bug or feature request we're likely to work on library-ffi labels Apr 15, 2024
@dcharkes dcharkes self-assigned this Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. library-ffi P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

1 participant