Closed
Description
The following program:
fn main() {
let uint b = 1u;
while (b <= 32u) {
0u << b;
b <<= 1u;
log b;
}
}
Gives the following output:
rt: 8d08:main:main: rust: 2 (0x2)
rt: 8d08:main:main: rust: 8 (0x8)
rt: 8d08:main:main: rust: 2048 (0x800)
The shift-left 0u << b
is necessary to make this happen, but 0u >> b
and 0u >>> b
suffice to reproduce the bug just as well. Also, changing b <<= 1u
to b = b << 1u
makes the bug go away.
Metadata
Metadata
Assignees
Labels
No labels