about summary refs log tree commit diff
path: root/src/tools/miri/tests/pass/atomic-readonly-load.rs
blob: 8f8086b3538c6ca397150c6203aa658ee9a8d3de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// Stacked Borrows doesn't like this.
//@compile-flags: -Zmiri-tree-borrows

use std::sync::atomic::*;

fn main() {
    // Atomic loads from read-only memory are fine if they are relaxed and small.
    static X: i32 = 0;
    let x = &X as *const i32 as *const AtomicI32;
    let x = unsafe { &*x };
    x.load(Ordering::Relaxed);
}