Skip to content

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

@dcharkes

Description

@dcharkes
@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

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.library-ffi

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions