https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96651
Bug ID: 96651 Summary: -fanalyzer switch Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: uso.cosmo.ray at gmail dot com Target Milestone: --- When compiling this code with -fanalyzer: static int a; int main(void) { char *src = NULL; char buf[128]; switch (a) { case 1: strcpy(buf, src); break; case 0: strcpy(buf, "hello"); } printf("%s\n", buf); } GCC seems to think the code can enter case 1 and use strcpy with a NULL value, but it can't because a is initialize to 0, and isn't touch anywhere. It also find have the same error if a isn't static. Note: I've create a small snippet of code that allow to reproduce the error, I've actually encounter the error here: https://github.com/curl/curl/pull/5815 in sws.c