about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-08 11:36:02 +0900
committerGitHub <noreply@github.com>2020-08-08 11:36:02 +0900
commitf5d2ffd7fb94807555cc370eb0ec01822f04abe3 (patch)
tree8e83eeced8fce2818f841b6fc065f69467f87998 /src/test
parentf3a9de9b08659e20ce7c282ed77bc43ddd149107 (diff)
parentc34c77c764491460449a6bef06b2149c3ab82f2d (diff)
downloadrust-f5d2ffd7fb94807555cc370eb0ec01822f04abe3.tar.gz
rust-f5d2ffd7fb94807555cc370eb0ec01822f04abe3.zip
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Amanieu
Don't call a function in function-arguments-naked.rs

Fixes #75096

It's U.B. to use anything other than inline assmebling in a naked
function. Fortunately, the `#break` directive works fine without
anything in the function body.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/debuginfo/function-arguments-naked.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/debuginfo/function-arguments-naked.rs b/src/test/debuginfo/function-arguments-naked.rs
index e88a99b322e..5f3a1eb44e4 100644
--- a/src/test/debuginfo/function-arguments-naked.rs
+++ b/src/test/debuginfo/function-arguments-naked.rs
@@ -3,6 +3,9 @@
 // We have to ignore android because of this issue:
 // https://github.com/rust-lang/rust/issues/74847
 // ignore-android
+//
+// We need to use inline assembly, so just use one platform
+// only-x86_64
 
 // compile-flags:-g
 
@@ -24,6 +27,7 @@
 // lldb-command:continue
 
 
+#![feature(asm)]
 #![feature(naked_functions)]
 #![feature(omit_gdb_pretty_printer_section)]
 #![omit_gdb_pretty_printer_section]
@@ -33,8 +37,6 @@ fn main() {
 }
 
 #[naked]
-fn naked(x: usize, y: usize) {
-    zzz(); // #break
+extern "C" fn naked(x: usize, y: usize) {
+    unsafe { asm!("ret"); } // #break
 }
-
-fn zzz() { () }