From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7F6FE3857428; Mon, 11 Oct 2021 21:47:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F6FE3857428 From: "eggert at cs dot ucla.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/102692] New: -Wanalyzer-null-dereference false alarm with (!p || q || !p->next) Date: Mon, 11 Oct 2021 21:47:53 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eggert at cs dot ucla.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Oct 2021 21:47:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102692 Bug ID: 102692 Summary: -Wanalyzer-null-dereference false alarm with (!p || q || !p->next) Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: eggert at cs dot ucla.edu Target Milestone: --- Created attachment 51588 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D51588&action=3Dedit compile on x86-64 with "gcc -fanalyzer -O2 -S analyzer-null-dereference-simple.i" I ran into this problem when compiling GNU Emacs with gcc 11.2.1 20210728 (= Red Hat 11.2.1-1) on x86-64. Compile the attached simplified version with: gcc -fanalyzer -O2 -S analyzer-null-dereference-simple.i and the output will be as at the end of this description. This output is bo= gus since it complains that 'tail' might be null in (!tail || end < prev || !tail->next) which means that tail->next might dereference a null pointer. = But the tail->next expression is obviously unreachable if 'tail' is null. Although this bug might be related to GCC bug 102671, I'm filing it separat= ely as it has a different feel.=