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

Re: catching 32/64 bit integer mixing

For open source projects, a few online static analyzers are available and usable for free. This kind of integer type mismach will be caught by most of them. Possibly clang-static-analyzer will do the job. Otherwise, an easy one is lgtm for example. See  https://lgtm.com/

(I have no link with them except as an open source software developer using their services for free).

There are other tools (mostly geared towards security)  available for free for open source software but I just forgot their name. Any web search tool should help you here.


Le 23/05/2020 à 09:03, Drew Parsons a écrit :
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?


Reply to: