r-lib / rray

Simple Arrays
https://rray.r-lib.org
GNU General Public License v3.0
130 stars 12 forks source link

Integer overflow errors #259

Open DavisVaughan opened 4 years ago

DavisVaughan commented 4 years ago
>   max_int <- 2147483647L
> rray(max_int) + 1L
<rray<int>[1]>
[1] NA
> rray(max_int) + 2L
<rray<int>[1]>
[1] -2147483647

We happen to get correct behavior here with +1L, but anything else is really not correct.

This ends up erroring CRAN's UBSAN builds that compile with -fsanitize=undefined. We have tests that check that integer overflow example and they give a run time error

Not sure how to fix this yet because we would need to control the xtensor + op