Nate Leong - 2021-06-29

I would like to find out whether the behavior of cppcheck 1.90 below is due to a bug or due to a check that was removed.

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

int main(void) {
  uint32_t bar, baz;
  bar = 42;
  uint64_t foo;
  foo = (uint64_t)bar + (uint64_t)baz;
  printf("%lu\n", foo);
  return 0;
}
# cppcheck version included in Ubuntu 18.04
$ cppcheck --version
Cppcheck 1.82
$ cppcheck sample.c
Checking sample.c ...
[sample.c:9]: (error) Uninitialized variable: baz
# cppcheck version included in Ubuntu 20.04
$ cppcheck --version
Cppcheck 1.90
$ cppcheck sample.c
Checking sample.c ...

Furthermore,

$ cppcheck --version
Cppcheck 2.4.1
$ cppcheck sample.c
Checking sample.c ...