about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-02-06 02:13:44 +0800
committerGitHub <noreply@github.com>2018-02-06 02:13:44 +0800
commiteb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5 (patch)
tree4f5b7a52c2d54f3c65a375ab01cd0c82ce6ecece /src/test/codegen
parent6c04c41034c46730fba97bfe9cfa2dd0687c2a5f (diff)
parenta29d8545b573d008e364571a83fcd865748a8ad8 (diff)
downloadrust-eb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5.tar.gz
rust-eb5a4617a5ef4cb8840ae40a31cd56f9ed243ee5.zip
Rollup merge of #46030 - Zoxc:asm-volatile, r=nikomatsakis
Make inline assembly volatile if it has no outputs. Fixes #46026
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/no-output-asm-is-volatile.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/codegen/no-output-asm-is-volatile.rs b/src/test/codegen/no-output-asm-is-volatile.rs
new file mode 100644
index 00000000000..457d706a8ff
--- /dev/null
+++ b/src/test/codegen/no-output-asm-is-volatile.rs
@@ -0,0 +1,26 @@
+// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -O
+
+// ignore-asmjs
+
+#![feature(asm)]
+#![crate_type = "lib"]
+
+// Check that inline assembly expressions without any outputs
+// are marked as having side effects / being volatile
+
+// CHECK-LABEL: @assembly
+#[no_mangle]
+pub fn assembly() {
+    unsafe { asm!("") }
+// CHECK: tail call void asm sideeffect "", {{.*}}
+}