about summary refs log tree commit diff
path: root/tests/codegen/cffi
diff options
context:
space:
mode:
Diffstat (limited to 'tests/codegen/cffi')
-rw-r--r--tests/codegen/cffi/c-variadic-naked.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/codegen/cffi/c-variadic-naked.rs b/tests/codegen/cffi/c-variadic-naked.rs
new file mode 100644
index 00000000000..807873ea368
--- /dev/null
+++ b/tests/codegen/cffi/c-variadic-naked.rs
@@ -0,0 +1,19 @@
+//@ needs-asm-support
+//@ only-x86_64
+
+// tests that `va_start` is not injected into naked functions
+
+#![crate_type = "lib"]
+#![feature(c_variadic)]
+#![feature(naked_functions)]
+#![no_std]
+
+#[naked]
+pub unsafe extern "C" fn c_variadic(_: usize, _: ...) {
+    // CHECK-NOT: va_start
+    // CHECK-NOT: alloca
+    core::arch::asm! {
+        "ret",
+        options(noreturn),
+    }
+}