Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uppub static disappears if only used from asm #13365
Comments
luqmana
added
I-wrong
and removed
I-enhancement
labels
Apr 7, 2014
This comment has been minimized.
This comment has been minimized.
|
Traige: still true |
This comment has been minimized.
This comment has been minimized.
|
Still an issue. Updated example: #![feature(asm)]
#[no_mangle]
pub static arr: [u8; 16] = [0; 16];
fn main() {
unsafe {
asm!("movups arr, %xmm0" ::: "xmm0");
}
} |
This comment has been minimized.
This comment has been minimized.
|
Error is different now:
|
This comment has been minimized.
This comment has been minimized.
|
The correct way to do this is to pass the array as a constrained variable (per @nagisa, who can provide more details) so that the compiler knows about the fact that |
nikomatsakis
closed this
Mar 9, 2017
This comment has been minimized.
This comment has been minimized.
|
Namely the code should be looking something like this:
instead. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kmcallister commentedApr 6, 2014
Adding an unused constraint
"r"(&arr)fixes it, as does passing&arrtotest::black_box(which does basically that).