Skip to content

[ffi] Varargs should give an error on uint8, int8, uint16, int16 and float #56058

Open
@dcharkes

Description

@dcharkes

Passing 8 bit or 16 bit ints in varargs is undefined behavior.

Clang will alert us:

Second argument to 'va_arg' is of promotable type 'uint16_t' (aka 'unsigned short'); this va_arg has undefined behavior because arguments will be promoted to 'int'clang(-Wvarargs)

But we allow this in dart:ffi, leading to undefined behavior.

We should consider adding an error message.

Discovered on:

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-native-interopUsed for native interop related issues, including FFI.contributions-welcomeContributions welcome to help resolve this (the resolution is expected to be clear from the issue)library-ffi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions