Skip to content

Commit 78e596a

Browse files
committed
---
yaml --- r: 16300 b: refs/heads/try c: ef32ffd h: refs/heads/master v: v3
1 parent b1bd25a commit 78e596a

File tree

8 files changed

+89
-4
lines changed

8 files changed

+89
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: db31969d4a10316169cfce858e10742cd588575e
5+
refs/heads/try: ef32ffd0b1602ff87536508a7f75fd9b1510b4e9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/rustc/back/link.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,11 @@ fn link_binary(sess: session,
637637
// and binutils 2.22+ won't add them automatically
638638
if sess.targ_cfg.os == session::os_linux {
639639
cc_args += ["-lrt", "-ldl"];
640+
641+
// LLVM implements the `frem` instruction as a call to `fmod`,
642+
// which lives in libm. Similar to above, on some linuxes we
643+
// have to be explicit about linking to it. See #2510
644+
cc_args += ["-lm"];
640645
}
641646

642647
if sess.targ_cfg.os == session::os_freebsd {

branches/try/src/rustc/middle/ty.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1678,8 +1678,11 @@ fn is_instantiable(cx: ctxt, r_ty: t) -> bool {
16781678

16791679
ty_class(did, substs) {
16801680
vec::push(*seen, did);
1681-
let r = vec::any(class_items_as_fields(cx, did, substs)) {|f|
1682-
type_requires(cx, seen, r_ty, f.mt.ty)};
1681+
let r = vec::any(lookup_class_fields(cx, did)) {|f|
1682+
let fty = ty::lookup_item_type(cx, f.id);
1683+
let sty = subst(cx, substs, fty.ty);
1684+
type_requires(cx, seen, r_ty, sty)
1685+
};
16831686
vec::pop(*seen);
16841687
r
16851688
}

branches/try/src/snapshots.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
S 2012-06-05 fec3b91
2+
winnt-i386 36348a2b016f25d9e3b7e1a8814a352c18123839
3+
linux-x86_64 7308f0eb3d6a9985c14dfbbde7e1f9eb901cc966
4+
linux-i386 d4c1e1733fd30945f96ae67dbc10289f2a9ec380
5+
freebsd-x86_64 d0ee6054d7d8320d64aa4dbb9b041537fa2665d5
6+
macos-x86_64 652501172b4fee6631f595c90538fd95914ef444
7+
macos-i386 5c54b5ecf54cc2631fdd48caa326ab44b5a2e494
8+
19
S 2012-06-04 7213274
210
winnt-i386 94b9414433fd83c086b349ded3159f0541aace16
311
linux-x86_64 eb9cf0de4cc09e8b8bfcf741eff4b20510e13a5b
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// xfail-test
2+
// error-pattern:bounds check
3+
4+
fn main() {
5+
let x = [1u,2u,3u];
6+
7+
// This should cause a bounds-check failure, but may not if we do our
8+
// bounds checking by comparing a scaled index value to the vector's
9+
// length (in bytes), because the scaling of the index will cause it to
10+
// wrap around to a small number.
11+
12+
let idx = uint::max_value & !(uint::max_value >> 1u);
13+
#error("ov2 idx = 0x%x", idx);
14+
15+
// This should fail.
16+
#error("ov2 0x%x", x[idx]);
17+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// xfail-test
2+
// error-pattern:bounds check
3+
4+
#[cfg(target_arch="x86")]
5+
fn main() {
6+
let x = [1u,2u,3u];
7+
8+
// This should cause a bounds-check failure, but may not if we do our
9+
// bounds checking by truncating the index value to the size of the
10+
// machine word, losing relevant bits of the index value.
11+
12+
// This test is only meaningful on 32-bit hosts.
13+
14+
let idx = u64::max_value & !(u64::max_value >> 1u);
15+
#error("ov3 idx = 0x%8.8x%8.8x",
16+
(idx >> 32) as uint,
17+
idx as uint);
18+
19+
// This should fail.
20+
#error("ov3 0x%x", x[idx]);
21+
}
22+
23+
#[cfg(target_arch="x86_64")]
24+
fn main() {
25+
// This version just fails anyways, for symmetry on 64-bit hosts.
26+
let x = [1u,2u,3u];
27+
#error("ov3 0x%x", x[200]);
28+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// error-pattern:bounds check
2+
3+
fn main() {
4+
5+
// This should cause a bounds-check failure, but may not if we do our
6+
// bounds checking by comparing the scaled index to the vector's
7+
// address-bounds, since we've scaled the index to wrap around to the
8+
// address of the 0th cell in the array (even though the index is
9+
// huge).
10+
11+
let x = [1u,2u,3u];
12+
vec::unpack_slice(x) {|p, _len|
13+
let base = p as uint; // base = 0x1230 say
14+
let idx = base / sys::size_of::<uint>(); // idx = 0x0246 say
15+
#error("ov1 base = 0x%x", base);
16+
#error("ov1 idx = 0x%x", idx);
17+
#error("ov1 sizeof::<uint>() = 0x%x", sys::size_of::<uint>());
18+
#error("ov1 idx * sizeof::<uint>() = 0x%x",
19+
idx * sys::size_of::<uint>());
20+
21+
// This should fail.
22+
#error("ov1 0x%x", x[idx]);
23+
}
24+
}

branches/try/src/test/run-pass/deep-vector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
2-
let _x = [
2+
let x = [
33
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
44
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

0 commit comments

Comments
 (0)