about summary refs log tree commit diff
path: root/src/test/codegen
diff options
context:
space:
mode:
authorcynecx <me@cynecx.net>2021-11-14 03:08:12 +0100
committercynecx <me@cynecx.net>2021-12-03 23:51:49 +0100
commit8e9ccdf28f91d56113117fd512819363602bdf89 (patch)
treea75948b40d1ecd62c5d1b79524a287848b985745 /src/test/codegen
parent686ace3b4119333f7d7868b05be2042fe56484a7 (diff)
downloadrust-8e9ccdf28f91d56113117fd512819363602bdf89.tar.gz
rust-8e9ccdf28f91d56113117fd512819363602bdf89.zip
add tests for asm's options(may_unwind)
Diffstat (limited to 'src/test/codegen')
-rw-r--r--src/test/codegen/asm-may_unwind.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/codegen/asm-may_unwind.rs b/src/test/codegen/asm-may_unwind.rs
new file mode 100644
index 00000000000..267eab7d105
--- /dev/null
+++ b/src/test/codegen/asm-may_unwind.rs
@@ -0,0 +1,24 @@
+// min-llvm-version: 13.0.0
+// compile-flags: -O
+
+#![crate_type = "rlib"]
+#![feature(asm, asm_unwind)]
+
+#[no_mangle]
+pub extern "C" fn panicky() {}
+
+struct Foo;
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!();
+    }
+}
+
+// CHECK-LABEL: @may_unwind
+// CHECK: invoke void asm sideeffect alignstack unwind
+#[no_mangle]
+pub unsafe fn may_unwind() {
+    let _m = Foo;
+    asm!("", options(may_unwind));
+}