about summary refs log tree commit diff
path: root/tests/run-make/mte-ffi/foo_int.rs
blob: 106d863cb8127cd5f295d09176daef3d649eea71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#![crate_type = "cdylib"]
#![crate_name = "foo"]

use std::os::raw::c_uint;

extern "C" {
    fn bar(ptr: *const c_uint);
}

#[no_mangle]
pub extern "C" fn foo(ptr: *mut c_uint) {
    assert_eq!((ptr as usize) >> 56, 0x1f);

    unsafe {
        *ptr = 0x63;
        *ptr.wrapping_add(1) = 0x64;
        bar(ptr);
    }
}