From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C55A53858409; Mon, 11 Oct 2021 22:21:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C55A53858409 From: "eggert at cs dot ucla.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/102692] -Wanalyzer-null-dereference false alarm with (!p || q || !p->next) Date: Mon, 11 Oct 2021 22:21:58 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: diagnostic 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: Message-ID: In-Reply-To: References: 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 22:21:58 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102692 --- Comment #1 from eggert at cs dot ucla.edu --- Sorry, forgot to mention the incorrect GCC output. Here it is: ----- analyzer-null-dereference-simple.i: In function =E2=80=98fix_overlays_befor= e=E2=80=99: analyzer-null-dereference-simple.i:79:35: warning: dereference of NULL =E2= =80=98tail=E2=80=99 [CWE-476] [-Wanalyzer-null-dereference] 79 | if (!tail || end < prev || !tail->next) | ~~~~^~~~~~ =E2=80=98fix_overlays_before=E2=80=99: events 1-5 | | 72 | while (tail | | ~~~~ | 73 | && (tem =3D make_lisp_ptr (tail, 5), | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) following =E2=80=98false=E2=80=99 branch (when = =E2=80=98tail=E2=80=99 is NULL)... | 74 | (end =3D marker_position (XOVERLAY (tem)->end)) >= =3D pos)) | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~ |...... | 79 | if (!tail || end < prev || !tail->next) | | ~~~~~~ ~~~~~~~~~~ | | || | | | || (4) ...to here | | |(2) ...to here (5) dereference of NULL =E2= =80=98tail=E2=80=99 | | (3) following =E2=80=98false=E2=80=99 branch... |=