-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #876 - RalfJung:atomic, r=RalfJung
check that atomics are sufficiently aligned Fixes #475
- Loading branch information
Showing
4 changed files
with
109 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#![feature(core_intrinsics)] | ||
|
||
fn main() { | ||
// Do a 4-aligned u64 atomic access. That should be UB on all platforms, | ||
// even if u64 only has alignment 4. | ||
let z = [0u32; 2]; | ||
let zptr = &z as *const _ as *const u64; | ||
unsafe { | ||
::std::intrinsics::atomic_load(zptr); | ||
//~^ ERROR tried to access memory with alignment 4, but alignment 8 is required | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters