about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-04-29 22:30:36 -0700
committerbors <bors@rust-lang.org>2013-04-29 22:30:36 -0700
commit84e22f2b8eacf30a5142a07d5e5667705c6a10d3 (patch)
treecf184f6430454e771338c5c0ff3c66099ef62114 /src/rustllvm/RustWrapper.cpp
parent48f50ac80063a6ebb59b1936b1e6020fd7a3251d (diff)
parentffa31d235badfb5544ddb2de151ccfc66c8a20e6 (diff)
downloadrust-84e22f2b8eacf30a5142a07d5e5667705c6a10d3.tar.gz
rust-84e22f2b8eacf30a5142a07d5e5667705c6a10d3.zip
auto merge of #6108 : gifnksm/rust/bigint-shift-bug, r=brson
`std::bigint` contains the following code.
```rust
borrow = *elem << (uint::bits - n_bits);
```
The code above contains a bug that the value of the right operand of the shift operator exceeds the size of the left operand,
because sizeof(*elem) == 32, and 0 <= n_bits < 32 in 64bit architecture.

If `--opt-level` option is not given to rustc, the code above runs as if the right operand is `(uint::bits - n_bits) % 32`,
but if --opt-level is given, `borrow` is always zero.

I wonder why this bug is not catched in the libstd's testsuite (I try the `rustc --test --opt-level=2 bigint.rs` before fixing the bug,
but the unittest passes normally.)

This pull request also removes the implicit vector copies in `bigint.rs`.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions