Skip to content

Commit

Permalink
Rollup merge of #75224 - Aaron1011:fix/function-arguments-naked, r=Am…
Browse files Browse the repository at this point in the history
…anieu

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.
  • Loading branch information
JohnTitor authored Aug 8, 2020
2 parents f3a9de9 + c34c77c commit f5d2ffd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/test/debuginfo/function-arguments-naked.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -24,6 +27,7 @@
// lldb-command:continue


#![feature(asm)]
#![feature(naked_functions)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
Expand All @@ -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() { () }

0 comments on commit f5d2ffd

Please sign in to comment.