]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | ||
11 | // ignore-android | |
3157f602 XL |
12 | // ignore-arm |
13 | // ignore-aarch64 | |
9e0c209e | 14 | // ignore-s390x |
1a4d82fc | 15 | |
c34b1796 | 16 | #![feature(asm, rustc_attrs)] |
1a4d82fc JJ |
17 | |
18 | #![allow(dead_code, non_upper_case_globals)] | |
19 | ||
20 | #[cfg(any(target_arch = "x86", | |
21 | target_arch = "x86_64"))] | |
c34b1796 AL |
22 | #[rustc_error] |
23 | pub fn main() { //~ ERROR compilation successful | |
1a4d82fc JJ |
24 | // assignment not dead |
25 | let mut x: isize = 0; | |
26 | unsafe { | |
27 | // extra colon | |
85aaf69f | 28 | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc"); |
1a4d82fc JJ |
29 | //~^ WARNING unrecognized option |
30 | } | |
31 | assert_eq!(x, 5); | |
32 | ||
33 | unsafe { | |
34 | // comma in place of a colon | |
85aaf69f | 35 | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile"); |
1a4d82fc JJ |
36 | //~^ WARNING expected a clobber, found an option |
37 | } | |
38 | assert_eq!(x, 13); | |
39 | } |