News for hackers. Stuff that matters.
Re:Chess.com stopped working on 32bit iPads because 2^31 gam... by mikeash on Monday June 12, 2017 @04:26PM (#14540802)
Alas, no. Signed overflow is UB and compilers can and will assume that it cannot happen when performing optimizations.
Re:Chess.com stopped working on 32bit iPads because 2^31 gam... by astrange on Tuesday June 13, 2017 @04:04AM (#14543462)
Which is a good thing, assuming you did reasonable testing with ubsan etc. Having to assume things that never happen is a big problem for optimization!
Re:Chess.com stopped working on 32bit iPads because 2^31 gam... by mikeash on Tuesday June 13, 2017 @04:17PM (#14548229)
That's a good point. Seems like we could do a bit better than the current state of the art, though. If non-optimized builds trapped on overflow, that would at least give you a better chance of detecting these problems before the optimizer starts throwing out code you meant to keep.