parent
f0c1f18314
commit
40b7502613
@ -126,6 +126,9 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
|
||||
"atomic_xsub_acqrel" |
|
||||
"atomic_xsub_relaxed" => {
|
||||
let ptr = self.ref_to_mplace(self.read_value(args[0])?)?;
|
||||
if !ptr.layout.ty.is_integral() {
|
||||
return err!(Unimplemented(format!("Atomic arithmetic operations only work on integer types")));
|
||||
}
|
||||
let rhs = self.read_value(args[1])?;
|
||||
let old = self.read_value(ptr.into())?;
|
||||
self.write_value(*old, dest)?; // old value is returned
|
||||
|
9
tests/compile-fail/atomic_non_integer_arithmetic.rs
Normal file
9
tests/compile-fail/atomic_non_integer_arithmetic.rs
Normal file
@ -0,0 +1,9 @@
|
||||
#![feature(core_intrinsics)]
|
||||
|
||||
pub fn main() {
|
||||
let mut z: f64 = 1.0;
|
||||
unsafe {
|
||||
::std::intrinsics::atomic_xadd(&mut z, 2.0);
|
||||
//~^ ERROR: Atomic arithmetic operations only work on integer types
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user