Skip to content

ip_mreqn roundtrip test fails for mips64 and sparc64  #1558

Open
@gnzlbg

Description

@gnzlbg

See discussion in #1555 . This link contains experiments for Rust and C: https://rust.godbolt.org/z/ak3pec

This struct has 3 fields, where each field is 4 bytes wide. The first two fields are a struct { u32 }, while the last fields is an i32. The struct is 12 bytes wide - no padding.

The roundtrip test initializes the struct bytes in Rust to the following values: [0, 1, 2, 3, ..., 11]. It then passes the struct by value to a C function expecting it. This function then reads the bytes of the struct and verifies that they match the values set on the Rust side. This fails, reporting that the last 4 bytes (the ones of the i32) are read as [0, 0, 0, 0] instead if [8, 9, 10, 11].

What we know:

  • the struct is available from the C headers, otherwise the C example that uses it without declaring it would not compile
  • the struct name, size, alignment requirement, as well as the field offsets of the struct match those of the C definition, because those tests do pass

So AFAICT the only thing that might be causing the error is an incorrect "call ABI", where the content of the 3rd struct field is being passed in the wrong register, and when C reads it from the right one, the contents are zeroed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-testsuiteE-mediumE-medium Call for participation: Medium difficulty. Experience needed to fix: Intermediate.O-mipsO-sparc

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions