Skip to content

Commit eafe106

Browse files
committedOct 15, 2015
Auto merge of #29012 - tari:issue-28676, r=luqmana
Fixes #28676. There doesn't seem to be a good way to add a test for this, but I tested the repro in #28676 and confirmed it now yields the correct result.
2 parents d20fe12 + 95721d3 commit eafe106

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed
 

‎src/librustc_trans/trans/cabi_x86_win64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn compute_abi_info(ccx: &CrateContext,
4646
2 => ArgType::direct(t, Some(Type::i16(ccx)), None, None),
4747
4 => ArgType::direct(t, Some(Type::i32(ccx)), None, None),
4848
8 => ArgType::direct(t, Some(Type::i64(ccx)), None, None),
49-
_ => ArgType::indirect(t, Some(Attribute::ByVal))
49+
_ => ArgType::indirect(t, None)
5050
}
5151
}
5252
_ => {

‎src/rt/rust_test_helpers.c

+4
Original file line numberDiff line numberDiff line change
@@ -218,3 +218,7 @@ uint64_t get_y(struct S s) {
218218
uint64_t get_z(struct S s) {
219219
return s.z;
220220
}
221+
222+
uint64_t get_c_many_params(void *a, void *b, void *c, void *d, struct quad f) {
223+
return f.c;
224+
}

‎src/test/run-pass/issue-28676.rs

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
//
11+
12+
#[derive(Copy, Clone)]
13+
pub struct Quad { a: u64, b: u64, c: u64, d: u64 }
14+
15+
mod rustrt {
16+
use super::Quad;
17+
18+
#[link(name = "rust_test_helpers")]
19+
extern {
20+
pub fn get_c_many_params(_: *const (), _: *const (),
21+
_: *const (), _: *const (), f: Quad) -> u64;
22+
}
23+
}
24+
25+
fn test() {
26+
unsafe {
27+
let null = std::ptr::null();
28+
let q = Quad {
29+
a: 1,
30+
b: 2,
31+
c: 3,
32+
d: 4
33+
};
34+
assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c);
35+
}
36+
}
37+
38+
pub fn main() {
39+
test();
40+
}

0 commit comments

Comments
 (0)