Skip to content

Commit 6d5b7d1

Browse files
committed
---
yaml --- r: 38461 b: refs/heads/incoming c: 25096a2 h: refs/heads/master i: 38459: a2e60d7 v: v3
1 parent 41fe7bc commit 6d5b7d1

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
9-
refs/heads/incoming: 0d8f447d560d378adebfbad948427adfc2f5ae22
9+
refs/heads/incoming: 25096a212a9ccaa0d181630af5971532c3472182
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/rustc/middle/trans/foreign.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,10 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
112112
Float => 4,
113113
Double => 8,
114114
Struct => {
115-
do vec::foldl(0, struct_tys(ty)) |s, t| {
116-
s + ty_size(*t)
117-
}
115+
let size = do vec::foldl(0, struct_tys(ty)) |s, t| {
116+
align(s, *t) + ty_size(*t)
117+
};
118+
align(size, ty)
118119
}
119120
Array => {
120121
let len = llvm::LLVMGetArrayLength(ty) as uint;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Issue #3656
2+
// Incorrect struct size computation in the FFI, because of not taking
3+
// the alignment of elements into account.
4+
5+
use libc::*;
6+
7+
struct KEYGEN {
8+
hash_algorithm: [c_uint]/2,
9+
count: uint32_t,
10+
salt: *c_void,
11+
salt_size: uint32_t,
12+
}
13+
14+
extern {
15+
// Bogus signature, just need to test if it compiles.
16+
pub fn malloc(++data: KEYGEN);
17+
}
18+
19+
fn main() {
20+
}

0 commit comments

Comments
 (0)