dsimcha: > Isn't overflowing a signed int undefined behavior? Yes, it can be.
>If so, how would we eliminate undefined behavior without very expensive >runtime checks?< I have explained LLVM devs how to speed-up some of those runtime checks. Do you exactly know how much expensive they are, in synthetic benchmarks or real programs? (I have done few tests in dotnet C#, that has a switch to activate those runtime tests, results are not conclusive). Do you prefer a less buggy program or a fast&buggy program? There are ways to infer and remove at compile time part of those tests (or sometimes pull them out of loops). Bye, bearophile