`OpEmitter::assert_unsigned_int32` blows up for `u32` case if values have high(32nd) bit set
greenhat opened this issue · comments
Discovered in #173.
The Rust a >= b
(both u32
) translates into the following IR:
compiler/tests/integration/expected/ge_u32.hir
Lines 12 to 17 in 663b146
From which the following MASM is generated:
compiler/tests/integration/expected/ge_u32.masm
Lines 659 to 670 in 663b146
The assertz
fails if a
or b
have high(32nd) bit set, which is a valid u32 value.
EDIT: Can be reproduced by the commented tests mentioning this issue in their comment.
After the fix, these tests should be enabled.
@bitwalker I hit it in #225. As a temporary workaround, I suggest we disable it and emit nothing when casting to u32.
Just to confirm a detail here: the bit being set is the 32nd bit? Or the 31st? 2^32 is not representable as a 32 bit integer, 2^32-1 is the maximum value that will fit in 32 bits.
From the get_inputs
test the value under cast is 4294967280 which is a valid u32 value with the 32nd bit set. But we're expecting the 32nd bit to be zero for u32 at