-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustc_target: avoid negative register counts in the SysV x86_64 ABI.
- Loading branch information
Showing
4 changed files
with
129 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/test/run-pass/abi/issues/issue-62350-sysv-neg-reg-counts.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// run-pass | ||
#![allow(dead_code)] | ||
#![allow(improper_ctypes)] | ||
|
||
// ignore-wasm32-bare no libc to test ffi with | ||
|
||
#[derive(Copy, Clone)] | ||
pub struct QuadFloats { a: f32, b: f32, c: f32, d: f32 } | ||
|
||
mod rustrt { | ||
use super::QuadFloats; | ||
|
||
#[link(name = "rust_test_helpers", kind = "static")] | ||
extern { | ||
pub fn get_c_exhaust_sysv64_ints( | ||
_: *const (), | ||
_: *const (), | ||
_: *const (), | ||
_: *const (), | ||
_: *const (), | ||
_: *const (), | ||
_: *const (), | ||
h: QuadFloats, | ||
) -> f32; | ||
} | ||
} | ||
|
||
fn test() { | ||
unsafe { | ||
let null = std::ptr::null(); | ||
let q = QuadFloats { | ||
a: 10.2, | ||
b: 20.3, | ||
c: 30.4, | ||
d: 40.5 | ||
}; | ||
assert_eq!( | ||
rustrt::get_c_exhaust_sysv64_ints(null, null, null, null, null, null, null, q), | ||
q.c, | ||
); | ||
} | ||
} | ||
|
||
pub fn main() { | ||
test(); | ||
} |