@@ -34,11 +34,17 @@ pub struct C2RustUnnamed_2 {
3434 pub x : ::core ::ffi ::c_short ,
3535 pub y : ::core ::ffi ::c_int ,
3636}
37- static mut simple : [::core ::ffi ::c_char ; 9 ] =
37+ #[no_mangle ]
38+ pub static mut static_char_array : [::core ::ffi ::c_char ; 9 ] =
3839 unsafe { ::core ::mem ::transmute ::< [u8 ; 9 ], [::core ::ffi ::c_char ; 9 ]> (* b " mystring\0 " ) };
39- static mut foo : * mut ::core ::ffi ::c_char =
40+ #[no_mangle ]
41+ pub static mut static_char_ptr : * mut ::core ::ffi ::c_char =
4042 b " mystring\0 " as *const u8 as *const ::core ::ffi ::c_char as *mut ::core ::ffi ::c_char ;
4143#[no_mangle ]
44+ pub static mut static_void_ptr : * mut ::core ::ffi ::c_void = unsafe {
45+ static_char_array .as_ptr () as *mut _ as *mut ::core ::ffi ::c_void
46+ };
47+ #[no_mangle ]
4248pub unsafe extern " C" fn entry () {
4349 let mut int_2d: [[::core ::ffi ::c_int ; 1 ]; 1 ] = [[1 as ::core ::ffi ::c_int ]];
4450 int_2d [0 as ::core ::ffi ::c_int as usize ][0 as ::core ::ffi ::c_int as usize ] +=
@@ -81,7 +87,7 @@ pub unsafe extern "C" fn entry() {
8187 );
8288 let mut int_var_ptr: *mut ::core ::ffi ::c_int = int_empty_init .as_mut_ptr ();
8389 let mut int_var_array_ptr: *mut [::core ::ffi ::c_int ; 16 ] = & mut int_empty_init ;
84- let mut char_var_ptr_var : *mut ::core ::ffi ::c_char = char_with_string .as_mut_ptr ();
90+ let mut char_var_ptr : *mut ::core ::ffi ::c_char = char_with_string .as_mut_ptr ();
8591 let mut char_var_array_ptr: *mut [::core ::ffi ::c_char ; 4 ] = & mut char_with_string ;
8692 let mut const_char_lit_ptr: *const ::core ::ffi ::c_char =
8793 b " abc\0 " as *const u8 as *const ::core ::ffi ::c_char ;
@@ -92,11 +98,12 @@ pub unsafe extern "C" fn entry() {
9298 let mut char_lit_array_ptr: *mut [::core ::ffi ::c_char ; 4 ] = b " abc\0 " as *const [u8 ; 4 ]
9399 as *const [::core ::ffi ::c_char ; 4 ]
94100 as *mut [::core ::ffi ::c_char ; 4 ];
95- let mut past_end: *mut ::core ::ffi ::c_char = & mut * simple
101+ let mut past_end: *mut ::core ::ffi ::c_char = & mut * static_char_array
96102 .as_mut_ptr ()
97103 .offset (::core ::mem ::size_of ::< [::core ::ffi ::c_char ; 9 ]> () as isize )
98104 as *mut ::core ::ffi ::c_char ;
99- past_end = & mut * foo .offset (8 as ::core ::ffi ::c_int as isize ) as *mut ::core ::ffi ::c_char ;
105+ past_end =
106+ & mut * static_char_ptr .offset (8 as ::core ::ffi ::c_int as isize ) as *mut ::core ::ffi ::c_char ;
100107}
101108#[no_mangle ]
102109pub unsafe extern " C" fn short_initializer () {
0 commit comments