public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109856] New: -Wnull-dereference false positive in Emacs itree.c (regression from GCC 12) Date: Sun, 14 May 2023 17:37:23 +0000 [thread overview] Message-ID: <bug-109856-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109856 Bug ID: 109856 Summary: -Wnull-dereference false positive in Emacs itree.c (regression from GCC 12) Product: gcc Version: 13.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: eggert at cs dot ucla.edu Target Milestone: --- Created attachment 55083 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55083&action=edit compile with 'gcc -O2 -Wnull-dereference' to reproduce the bug This is GCC 13.1.1 20230426 (Red Hat 13.1.1-1) on x86-64, and this is a regression from GCC (Ubuntu 12.2.0-17ubuntu1) 12.2.0. I ran into this problem when compiling GNU Emacs src/itree.c. This is a stripped-down version of the original problem (the code makes no sense by itself). Compile the attached program with: gcc -O2 -S -Wnull-dereference v2.i The output is: v2.i: In function ‘itree_remove_fix’: v2.i:28:16: warning: potential null pointer dereference [-Wnull-dereference] 28 | if (other->left) | ~~~~~^~~~~~ First, the diagnostic is confusing, because it highlights an entire expression, which cannot itself be a null pointer dereference. Second, there's no possible null pointer dereference here. The previous two lines are "if (!other)__builtin_unreachable ();" so OTHER itself cannot be null.
next reply other threads:[~2023-05-14 17:37 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-14 17:37 eggert at cs dot ucla.edu [this message] 2023-06-16 5:28 ` [Bug middle-end/109856] " eggert at cs dot ucla.edu
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-109856-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).