Closed
Description
Given the following setup:
test.rs:
#![feature(i128_type)]
#[repr(C)]
#[derive(Copy, Clone, PartialEq, Debug)]
struct Foo {
a: i128,
b: i8,
c: u16,
}
#[link(name = "test", kind = "static")]
extern "C" {
fn foo(f: Foo) -> Foo;
}
fn main() {
unsafe {
let a = Foo { a: 1, b: 2, c: 3 };
let b = foo(a);
assert_eq!(a, b);
}
}
test.c:
#include <stdint.h>
struct Foo {
__int128 a;
int8_t b;
uint16_t c;
};
struct Foo foo(struct Foo foo) {
return foo;
}
gcc version 6.2.0
, rust of current master (ac5cd3b), and a 64 bit gnu/linux platform, main will panic:
thread 'main' panicked at 'assertion failed: `(left == right)` (left: `Foo { a: 139755467620616, b: 2, c: 3 }`, right: `Foo { a: 1, b: 2, c: 3 }`)'