From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3DA1638582B3; Wed, 10 Jan 2024 20:42:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DA1638582B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704919336; bh=tbHdRM8N4GkjiNtnmiL5Z1SR2+57b+JZXvuljRcmOMQ=; h=From:To:Subject:Date:From; b=GESdgdIVYPgZXsg+YT8s/FmfGkpFM/akofkWxIUcyq7w3KRSbdXYOm1GktEqEmiDm 8vXYs1NiNgHmfcCTfV8uki1KW20Xi1vntfbZLlgRD8dlWs3kZJxLWYMBi28xuCywWA SxAIEH/SiprOAqOdf953tpsbU3F962Y9pvDN+fZQ= From: "dmalcolm at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/113314] New: -Wanalyzer-infinite-loop false positive seen on haproxy's fd.c Date: Wed, 10 Jan 2024 20:42:15 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dmalcolm at gcc dot gnu.org 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113314 Bug ID: 113314 Summary: -Wanalyzer-infinite-loop false positive seen on haproxy's fd.c Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- Created attachment 57027 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57027&action=3Dedit Reproducer https://godbolt.org/z/1oYYear8z t.c: In function =E2=80=98fd_add_to_fd_list=E2=80=99: t.c:71:15: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop] 71 | next =3D fdtab[fd].update.next; | ^ =E2=80=98fd_add_to_fd_list=E2=80=99: events 1-5 | | 71 | next =3D fdtab[fd].update.next; | | ^ | | | | | (1) infinite loop here | 72 | if (next > -2) | | ~=20=20=20=20=20=20=20=20=20 | | | | | (2) if it ever follows =E2=80=98false=E2=80=99 branch, it= will always do so... | 73 | goto done; | 74 | if (next =3D=3D -2) | | ~=20=20=20=20=20=20=20=20=20 | | | | | (3) ...to here | | (4) if it ever follows =E2=80=98true=E2=80=99 branch, it = will always do so... | 75 | goto redo_next; | | ~~~~=20=20=20=20=20=20=20 | | | | | (5) ...to here | =E2=80=98fd_add_to_fd_list=E2=80=99: event 6 | |cc1: | (6): looping back... | =E2=80=98fd_add_to_fd_list=E2=80=99: event 7 | | 71 | next =3D fdtab[fd].update.next; | | ^ | | | | | (7) ...to here Seen on haproxy-2.7.1's src/fd.c (in analyzer integration tests).=