Skip to content

Add more boundary checks for `rem` and `mod`

John Ericson requested to merge wip/defensive-rem-mod into master

It's quite backend-dependent whether we will actually handle that case right, so let's just always do this as a precaution.

In particular, once we replace the native primops used here with the new sized primops, the 16-bit ones on x86 will begin to use 16-bit sized instructions where they didn't before.

Though I'm not sure of any arch which has 8-bit scalar instructions, I also did those for consistency. Plus, there are vector 8-bit ops in the wild, so if we ever got into autovectorization or something maybe it's prudent to put this here as a reminder not to forget about catching overflows.

Progress towards #19026 (closed)

Merge request reports