public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dmalcolm at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109131] New: -Wanalyzer-deref-before-check false positive seen in git's builtin/show-ref.c Date: Tue, 14 Mar 2023 19:30:30 +0000 [thread overview] Message-ID: <bug-109131-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109131 Bug ID: 109131 Summary: -Wanalyzer-deref-before-check false positive seen in git's builtin/show-ref.c Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Created attachment 54664 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54664&action=edit Reduced reproducer Trunk erroneously emits: deref-before-check-git-show-ref.c: In function 'cmd_show_ref': deref-before-check-git-show-ref.c:39:8: warning: check of 'argv' for NULL after already dereferencing it [-Wanalyzer-deref-before-check] 39 | if (!pattern) | ^ 'cmd_show_ref': events 1-8 | | 31 | if (exclude_arg) | | ^ | | | | | (1) following 'false' branch... |...... | 34 | pattern = argv; | | ~~~~~~~~~~~~~~ | | | | | (2) ...to here | 35 | if (!*pattern) | | ~ ~~~~~~~~ | | | | | | | (3) pointer 'argv' is dereferenced here | | (4) following 'false' branch... |...... | 38 | if (verify) { | | ~~~~~~~ | | || | | |(5) ...to here | | (6) following 'true' branch... | 39 | if (!pattern) | | ~~~~~~~~~ | | || | | |(7) ...to here | | (8) pointer 'argv' is checked for NULL here but it was already dereferenced at (3) | on the attached. https://godbolt.org/z/oW4hvqx7K
next reply other threads:[~2023-03-14 19:30 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-03-14 19:30 dmalcolm at gcc dot gnu.org [this message] 2023-10-27 17:50 ` [Bug analyzer/109131] " alexey.lapshin at espressif dot com 2024-02-15 19:56 ` [Bug analyzer/109131] [13/14 Regression] " dmalcolm at gcc dot gnu.org 2024-03-04 13:00 ` rguenth at gcc dot gnu.org 2024-03-08 15:38 ` law at gcc dot gnu.org 2024-05-21 9:14 ` [Bug analyzer/109131] [13/14/15 " jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-109131-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).