Realloc is supposed to get special handling to prevent the cast in realloc(p as *mut c_void, n) from causing an error. However, this doesn't seem to work reliably.
Example code (add this to tests/filecheck/alloc.rs):
pub unsafe fn realloc2(p: *mut u8, n: usize) {
let q = realloc(p as *mut libc::c_void, (n + 1) as libc::c_ulong);
}
This produces the error: [ERROR @ c2rust-analyze/src/dataflow/type_check.rs:147 @ c2rust_analyze::dataflow::type_check]: TODO: unsupported ptr-to-ptr cast between pointee types not yet supported as safely transmutable: `*mut u8 as *mut libc::c_void`
Realloc is supposed to get special handling to prevent the cast in
realloc(p as *mut c_void, n)
from causing an error. However, this doesn't seem to work reliably.Example code (add this to
tests/filecheck/alloc.rs
):This produces the error:
[ERROR @ c2rust-analyze/src/dataflow/type_check.rs:147 @ c2rust_analyze::dataflow::type_check]: TODO: unsupported ptr-to-ptr cast between pointee types not yet supported as safely transmutable: `*mut u8 as *mut libc::c_void`
Changing
n + 1
ton
produces a different error: