https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95000

            Bug ID: 95000
           Summary: -fanalyzer confused by switch
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: felix-gcc at fefe dot de
  Target Milestone: ---

Consider this contrived test code:

void proof(char* x) {
  char* y=0;
  switch (*x) {
  case 'a':
    y="foo";
  case 'b':
    if (*x=='a') *y='b';
  }
}

-fanalyzer will warn about the *y='b' statement, that y might be NULL here.
However if *x=='a' then we got here via the case 'a' case which initialized it.

Other than this minor false positive issue thank you for -fanalyzer! It has
already found a few bugs for me!

Reply via email to