[Bug analyzer/113314] New: -Wanalyzer-infinite-loop false positive seen on haproxy's fd.c
dmalcolm at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 10 20:42:15 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113314
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=57027&action=edit
Reproducer
https://godbolt.org/z/1oYYear8z
t.c: In function ‘fd_add_to_fd_list’:
t.c:71:15: warning: infinite loop [CWE-835] [-Wanalyzer-infinite-loop]
71 | next = fdtab[fd].update.next;
| ^
‘fd_add_to_fd_list’: events 1-5
|
| 71 | next = fdtab[fd].update.next;
| | ^
| | |
| | (1) infinite loop here
| 72 | if (next > -2)
| | ~
| | |
| | (2) if it ever follows ‘false’ branch, it will always do
so...
| 73 | goto done;
| 74 | if (next == -2)
| | ~
| | |
| | (3) ...to here
| | (4) if it ever follows ‘true’ branch, it will always do so...
| 75 | goto redo_next;
| | ~~~~
| | |
| | (5) ...to here
|
‘fd_add_to_fd_list’: event 6
|
|cc1:
| (6): looping back...
|
‘fd_add_to_fd_list’: event 7
|
| 71 | next = fdtab[fd].update.next;
| | ^
| | |
| | (7) ...to here
Seen on haproxy-2.7.1's src/fd.c (in analyzer integration tests).
More information about the Gcc-bugs
mailing list