Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing semicolon after volatile pointer cast. #1049

Open
ahaoboy opened this issue Dec 3, 2023 · 0 comments
Open

Missing semicolon after volatile pointer cast. #1049

ahaoboy opened this issue Dec 3, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ahaoboy
Copy link

ahaoboy commented Dec 3, 2023

 c2rust --version
C2Rust 0.18.0 (2023-12-03)

C

#include <stdio.h>
int main()
{
  const char *volatile str = NULL;
  int c = (unsigned char)*str++;
  return 0;
}

Output

use ::libc;
unsafe fn main_0() -> libc::c_int {
    let mut str: *const libc::c_char = 0 as *const libc::c_char;
    let fresh0 = ::core::ptr::read_volatile::<
        *const libc::c_char,
    >(&str as *const *const libc::c_char);
    ::core::ptr::write_volatile(
        &mut str as *mut *const libc::c_char,
        (::core::ptr::read_volatile::<
            *const libc::c_char,
        >(&str as *const *const libc::c_char))
            .offset(1),
    )
    let mut c: libc::c_int = *fresh0 as libc::c_uchar as libc::c_int;
    return 0 as libc::c_int;
}
pub fn main() {
    unsafe { ::std::process::exit(main_0() as i32) }
}
@kkysen kkysen added the bug Something isn't working label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants