Merge commit 'e4fe941b11
' into subtree-update_cg_gcc_2023-10-25
This commit is contained in:
commit
c797cccda6
47 changed files with 2659 additions and 502 deletions
26
compiler/rustc_codegen_gcc/tests/run/volatile.rs
Normal file
26
compiler/rustc_codegen_gcc/tests/run/volatile.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Compiler:
|
||||
//
|
||||
// Run-time:
|
||||
// status: 0
|
||||
|
||||
use std::mem::MaybeUninit;
|
||||
|
||||
#[derive(Debug)]
|
||||
struct Struct {
|
||||
pointer: *const (),
|
||||
func: unsafe fn(*const ()),
|
||||
}
|
||||
|
||||
fn func(ptr: *const ()) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut x = MaybeUninit::<&Struct>::uninit();
|
||||
x.write(&Struct {
|
||||
pointer: std::ptr::null(),
|
||||
func,
|
||||
});
|
||||
let x = unsafe { x.assume_init() };
|
||||
let value = unsafe { (x as *const Struct).read_volatile() };
|
||||
println!("{:?}", value);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue