]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/asm-misplaced-option.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / asm / asm-misplaced-option.rs
1 // ignore-android
2 // ignore-arm
3 // ignore-aarch64
4 // ignore-s390x
5 // ignore-emscripten
6 // ignore-powerpc
7 // ignore-powerpc64
8 // ignore-powerpc64le
9 // ignore-sparc
10 // ignore-sparc64
11 // ignore-mips
12 // ignore-mips64
13
14 // compile-pass
15 // skip-codegen
16 #![feature(asm)]
17 #![allow(dead_code, non_upper_case_globals)]
18
19 #[cfg(any(target_arch = "x86",
20           target_arch = "x86_64"))]
21 pub fn main() {
22     // assignment not dead
23     let mut x: isize = 0;
24     unsafe {
25         // extra colon
26         asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
27         //~^ WARNING unrecognized option
28     }
29     assert_eq!(x, 5);
30
31     unsafe {
32         // comma in place of a colon
33         asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
34         //~^ WARNING expected a clobber, found an option
35     }
36     assert_eq!(x, 13);
37 }