[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

catching 32/64 bit integer mixing



An upstream author has asked whether we know of tools or compiler flags to help catch problems mixing 64 and 32 bit integers, for instance catching implicit conversions, as in

  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


Reply to: