public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086`
@ 2023-07-02 12:30 dale.mengli.ming at proton dot me
  2023-09-06 21:37 ` [Bug analyzer/110520] " dmalcolm at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dale.mengli.ming at proton dot me @ 2023-07-02 12:30 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110520
           Summary: -Wanalyzer-null-dereference false nagetive with `*ptr
                    = 10086`
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dale.mengli.ming at proton dot me
  Target Milestone: ---

Hi,in this case (https://godbolt.org/z/4Md3o94Gx), the `ptr` is a null pointer,
but the analyzer doesn't report an NPD with it. When `__builtin_strlen(buf) ==
0` (https://godbolt.org/z/fnbMY9W5z), the analyzer reports that.

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

* [Bug analyzer/110520] -Wanalyzer-null-dereference false nagetive with `*ptr = 10086`
  2023-07-02 12:30 [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086` dale.mengli.ming at proton dot me
@ 2023-09-06 21:37 ` dmalcolm at gcc dot gnu.org
  2023-10-25  8:18 ` dale.mengli.ming at proton dot me
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-09-06 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2023-09-06

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this bug.

With trunk (for gcc 14) I correctly get a NPD warning (true positive):
  https://godbolt.org/z/a5h38cz7d

With gcc 13.2, I don't (false negative):
  https://godbolt.org/z/PKnToYK8v

I've been rewriting C string handling for gcc 14, so it's likely this now
working is a side-effect of that.

Keeping open to track adding a regression test for this.

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

* [Bug analyzer/110520] -Wanalyzer-null-dereference false nagetive with `*ptr = 10086`
  2023-07-02 12:30 [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086` dale.mengli.ming at proton dot me
  2023-09-06 21:37 ` [Bug analyzer/110520] " dmalcolm at gcc dot gnu.org
@ 2023-10-25  8:18 ` dale.mengli.ming at proton dot me
  2024-02-19 23:10 ` [Bug analyzer/110520] -Wanalyzer-null-dereference false negative " cvs-commit at gcc dot gnu.org
  2024-02-19 23:15 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dale.mengli.ming at proton dot me @ 2023-10-25  8:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from mengli ming <dale.mengli.ming at proton dot me> ---
(In reply to David Malcolm from comment #1)
> Thanks for filing this bug.
> 
> With trunk (for gcc 14) I correctly get a NPD warning (true positive):
>   https://godbolt.org/z/a5h38cz7d
> 
> With gcc 13.2, I don't (false negative):
>   https://godbolt.org/z/PKnToYK8v
> 
> I've been rewriting C string handling for gcc 14, so it's likely this now
> working is a side-effect of that.
> 
> Keeping open to track adding a regression test for this.

Thank you for your explanation. (^_^)

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

* [Bug analyzer/110520] -Wanalyzer-null-dereference false negative with `*ptr = 10086`
  2023-07-02 12:30 [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086` dale.mengli.ming at proton dot me
  2023-09-06 21:37 ` [Bug analyzer/110520] " dmalcolm at gcc dot gnu.org
  2023-10-25  8:18 ` dale.mengli.ming at proton dot me
@ 2024-02-19 23:10 ` cvs-commit at gcc dot gnu.org
  2024-02-19 23:15 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-19 23:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

https://gcc.gnu.org/g:eb37ea529745c38dcf86c3cdbedb66df69ea9e35

commit r14-9075-geb37ea529745c38dcf86c3cdbedb66df69ea9e35
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Mon Feb 19 18:07:59 2024 -0500

    analyzer, testsuite: add regression test [PR110520]

    gcc/testsuite/ChangeLog:
            PR analyzer/110520
            * c-c++-common/analyzer/null-deref-pr110520.c: New test.

    Signed-off-by: David Malcolm <dmalcolm@redhat.com>

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

* [Bug analyzer/110520] -Wanalyzer-null-dereference false negative with `*ptr = 10086`
  2023-07-02 12:30 [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086` dale.mengli.ming at proton dot me
                   ` (2 preceding siblings ...)
  2024-02-19 23:10 ` [Bug analyzer/110520] -Wanalyzer-null-dereference false negative " cvs-commit at gcc dot gnu.org
@ 2024-02-19 23:15 ` dmalcolm at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-02-19 23:15 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #1)
> Keeping open to track adding a regression test for this.

Regression test added; closing.

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

end of thread, other threads:[~2024-02-19 23:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-02 12:30 [Bug analyzer/110520] New: -Wanalyzer-null-dereference false nagetive with `*ptr = 10086` dale.mengli.ming at proton dot me
2023-09-06 21:37 ` [Bug analyzer/110520] " dmalcolm at gcc dot gnu.org
2023-10-25  8:18 ` dale.mengli.ming at proton dot me
2024-02-19 23:10 ` [Bug analyzer/110520] -Wanalyzer-null-dereference false negative " cvs-commit at gcc dot gnu.org
2024-02-19 23:15 ` dmalcolm 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).