truth icon indicating copy to clipboard operation
truth copied to clipboard

audit for downsizing casts of literals that should produce warnings

Open ExpHP opened this issue 4 years ago • 0 comments

Things like takes_word_sized_value(0x10000) should produce a warning.

The reason they don't, as far as I can remember, is because for a long time, RawInstr did not have any Spans, so even if I wanted to check a value for being out of range, I wouldn't be able to generate a helpful diagnostic. That problem is solved now, but many places remain in the lowering code that simply do a cast of a user-supplied literal without checking value range. This will require some sort of audit.

ExpHP avatar Nov 12 '21 23:11 ExpHP