public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/109856] New: -Wnull-dereference false positive in Emacs itree.c (regression from GCC 12)
@ 2023-05-14 17:37 eggert at cs dot ucla.edu
2023-06-16 5:28 ` [Bug middle-end/109856] " eggert at cs dot ucla.edu
0 siblings, 1 reply; 2+ messages in thread
From: eggert at cs dot ucla.edu @ 2023-05-14 17:37 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-16 5:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-14 17:37 [Bug middle-end/109856] New: -Wnull-dereference false positive in Emacs itree.c (regression from GCC 12) eggert at cs dot ucla.edu
2023-06-16 5:28 ` [Bug middle-end/109856] " eggert at cs dot ucla.edu
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).