Skip to content

Commit aeaa12b

Browse files
committed
trans: add range asserts to loads of char
1 parent 3f5b221 commit aeaa12b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc/middle/trans/datum.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ use middle::ty;
104104
use util::common::indenter;
105105
use util::ppaux::ty_to_str;
106106

107+
use std::char;
107108
use std::uint;
109+
use std::libc::c_ulonglong;
108110
use syntax::ast;
109111
use syntax::codemap::Span;
110112
use syntax::parse::token::special_idents;
@@ -439,7 +441,10 @@ impl Datum {
439441
ByValue => self.val,
440442
ByRef(_) => {
441443
if ty::type_is_bool(self.ty) {
442-
LoadRangeAssert(bcx, self.val, 0, 2, lib::llvm::True)
444+
LoadRangeAssert(bcx, self.val, 0, 2, lib::llvm::False)
445+
} else if ty::type_is_char(self.ty) {
446+
LoadRangeAssert(bcx, self.val, 0, char::MAX as c_ulonglong + 1,
447+
lib::llvm::False)
443448
} else {
444449
Load(bcx, self.val)
445450
}

0 commit comments

Comments
 (0)