int64_t n = ...;
for (int32_t i=0; i<n; i++) {
...
}
There is -fsanitize=signed-integer-overflow (which generates a runtime
error message), but that requires data to cause overflow at every
possible location.
Is there a better tool for catching this kind of problem? Drew