]> git.lizzy.rs Git - rust.git/commit
[miri] Throw UB if target size and data size don't match
authorSamrat Man Singh <samratmansingh@gmail.com>
Sun, 26 Apr 2020 03:28:22 +0000 (08:58 +0530)
committerSamrat Man Singh <samratmansingh@gmail.com>
Sun, 26 Apr 2020 03:28:22 +0000 (08:58 +0530)
commit91462db9f1c1b5db941c22efb64e7ec01d472911
tree1193fd124b8a4a166e44b814c2f03946a83621fb
parent659951c4a0d7450e43f61c61c0e87d0ceae17087
[miri] Throw UB if target size and data size don't match

If an extern C function is defined as

```
extern "C" {
    fn malloc(size: u32) -> *mut std::ffi::c_void;
}
```

on a 64-bit machine(ie. pointer sizes don't match), throw an undefined
behaviour.
src/librustc_middle/mir/interpret/error.rs
src/librustc_middle/mir/interpret/value.rs