Skip to content

Commit 88e986b

Browse files
committed
---
yaml --- r: 156591 b: refs/heads/try c: 5bcd0a0 h: refs/heads/master i: 156589: 31e805c 156587: d332e6c 156583: 9910af1 156575: c4673a8 v: v3
1 parent b571a87 commit 88e986b

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: a34b8dec697014f15e725215e17ea8d956c0ab1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
5-
refs/heads/try: 61ab2ea08ae669711c5d9c0c069da2d0a8606639
5+
refs/heads/try: 5bcd0a0b5030487613bee37ed38945e42c4e6b85
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 6601b0501e31d08d3892a2d5a7d8a57ab120bf75

branches/try/src/librustc/middle/trans/adt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ fn ensure_struct_fits_in_address_space(ccx: &CrateContext,
478478
offset += machine::llsize_of_alloc(ccx, llty);
479479

480480
// We can get away with checking for overflow once per iteration,
481-
// because field sizes are less than 1<<60.
481+
// because field sizes are less than 1<<61.
482482
if offset >= ccx.max_obj_size() {
483483
ccx.report_overbig_object(scapegoat);
484484
}
@@ -498,7 +498,7 @@ fn ensure_enum_fits_in_address_space(ccx: &CrateContext,
498498
let discr_size = machine::llsize_of_alloc(ccx, ll_inttype(ccx, discr));
499499
let (field_size, field_align) = union_size_and_align(fields);
500500

501-
// This can't overflow because field_size, discr_size, field_align < 1<<60
501+
// This can't overflow because field_size, discr_size, field_align < 1<<61
502502
let total_size = roundup(discr_size, field_align) + field_size;
503503

504504
if total_size >= ccx.max_obj_size() {

branches/try/src/librustc/middle/trans/common.rs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,17 +596,34 @@ pub fn C_u64(ccx: &CrateContext, i: u64) -> ValueRef {
596596
}
597597

598598
pub fn C_int<I: AsI64>(ccx: &CrateContext, i: I) -> ValueRef {
599-
C_integral(ccx.int_type(), i.as_i64() as u64, true)
599+
let v = i.as_i64();
600+
601+
match machine::llbitsize_of_real(ccx.int_type()) {
602+
32 => assert!(v < (1<<31) && v >= -(1<<31)),
603+
64 => {},
604+
n => fail!("unsupported target size: {}", n)
605+
}
606+
607+
C_integral(ccx.int_type(), v as u64, true)
600608
}
601609

602610
pub fn C_uint<I: AsU64>(ccx: &CrateContext, i: I) -> ValueRef {
603-
C_integral(ccx.int_type(), i.as_u64(), false)
611+
let v = i.as_u64();
612+
613+
match machine::llbitsize_of_real(ccx.int_type()) {
614+
32 => assert!(v < (1<<32)),
615+
64 => {},
616+
n => fail!("unsupported target size: {}", n)
617+
}
618+
619+
C_integral(ccx.int_type(), v, false)
604620
}
605621

606622
pub trait AsI64 { fn as_i64(self) -> i64; }
607623
pub trait AsU64 { fn as_u64(self) -> u64; }
608624

609-
// FIXME: remove the intptr conversions
625+
// FIXME: remove the intptr conversions, because they
626+
// are host-architecture-dependent
610627
impl AsI64 for i64 { fn as_i64(self) -> i64 { self as i64 }}
611628
impl AsI64 for i32 { fn as_i64(self) -> i64 { self as i64 }}
612629
impl AsI64 for int { fn as_i64(self) -> i64 { self as i64 }}

0 commit comments

Comments
 (0)