public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/95000] New: -fanalyzer confused by switch
@ 2020-05-08  8:59 felix-gcc at fefe dot de
  2020-05-08  9:49 ` [Bug analyzer/95000] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: felix-gcc at fefe dot de @ 2020-05-08  8:59 UTC (permalink / raw)
  To: gcc-bugs

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!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-03-15 21:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-08  8:59 [Bug analyzer/95000] New: -fanalyzer confused by switch felix-gcc at fefe dot de
2020-05-08  9:49 ` [Bug analyzer/95000] " jakub at gcc dot gnu.org
2020-05-08  9:57 ` felix-gcc at fefe dot de
2020-05-08 14:11 ` dmalcolm at gcc dot gnu.org
2020-05-08 14:25 ` [Bug analyzer/95000] -fanalyzer confused by switch on non-int type dmalcolm at gcc dot gnu.org
2021-02-11 15:12 ` dimhen at gmail dot com
2022-03-15 18:45 ` dmalcolm at gcc dot gnu.org
2022-03-15 21:57 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).