Geoffrey1014 / SA_Bugs

record bugs of static analyzers
3 stars 1 forks source link

GCC --Wanayzer-null-dereference false positive with giving weird path infomation #8

Open Geoffrey1014 opened 1 year ago

Geoffrey1014 commented 1 year ago

date: 2022-10-21 commit: version 12.1 args: -O0 -fanalyzer test:

#include <stdio.h>
int main() {   
  int e = 10086;
  int *f = &e;
  int g = 0;
  int *h[2][1];
  h[1][0] = f;
  if (g == (h[1][0])) {
    // printf("if true\n");
    unsigned int *i = 0;
  }
  printf("NPD_FLAG: %d\n ", *f);
  return 0;
}

report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107345 fix: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=18faaeb3af42f3d7dc609b9b91df77d0d59b16f6 original:

ghost commented 1 year ago

CSA not FP: https://godbolt.org/z/rsK81cMnb