Skip to content

Commit 7247ed5

Browse files
committed
---
yaml --- r: 39891 b: refs/heads/dist-snap c: 25096a2 h: refs/heads/master i: 39889: 31cd74b 39887: 6ad321d v: v3
1 parent 4519ed2 commit 7247ed5

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
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: 0d8f447d560d378adebfbad948427adfc2f5ae22
10+
refs/heads/dist-snap: 25096a212a9ccaa0d181630af5971532c3472182
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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)