public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/113314] New: -Wanalyzer-infinite-loop false positive seen on haproxy's fd.c
@ 2024-01-10 20:42 dmalcolm at gcc dot gnu.org
  2024-01-10 22:01 ` [Bug analyzer/113314] " dmalcolm at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2024-01-10 20:42 UTC (permalink / raw)
  To: gcc-bugs

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).

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-05-07  7:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 20:42 [Bug analyzer/113314] New: -Wanalyzer-infinite-loop false positive seen on haproxy's fd.c dmalcolm at gcc dot gnu.org
2024-01-10 22:01 ` [Bug analyzer/113314] " dmalcolm at gcc dot gnu.org
2024-02-16 13:54 ` [Bug analyzer/113314] [14 Regression] " dmalcolm at gcc dot gnu.org
2024-03-04 13:05 ` rguenth at gcc dot gnu.org
2024-03-07 20:51 ` law at gcc dot gnu.org
2024-03-25 16:12 ` dmalcolm at gcc dot gnu.org
2024-03-25 18:40 ` pinskia at gcc dot gnu.org
2024-05-07  7:43 ` [Bug analyzer/113314] [14/15 " rguenth at gcc dot gnu.org

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).