From a29d8545b573d008e364571a83fcd865748a8ad8 Mon Sep 17 00:00:00 2001 From: John Kåre Alsaker Date: Thu, 16 Nov 2017 10:08:19 +0100 Subject: Make inline assembly volatile if it has no outputs. Fixes #46026 --- src/test/codegen/no-output-asm-is-volatile.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/codegen/no-output-asm-is-volatile.rs (limited to 'src/test/codegen') 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 or the MIT license +// , 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 "", {{.*}} +} -- cgit 1.4.1-3-g733a5