public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive @ 2024-04-10 13:24 levon at movementarian dot org 2024-04-10 16:49 ` [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param dmalcolm at gcc dot gnu.org ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: levon at movementarian dot org @ 2024-04-10 13:24 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114677 Bug ID: 114677 Summary: apparent -Wanalyzer-fd-leak false positive Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: levon at movementarian dot org Target Milestone: --- Created attachment 57920 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57920&action=edit reproducer https://godbolt.org/z/PfKKbPhdP reproduced with today's trunk Also attached gives <source>: In function 'try_bind_socket': <source>:37:8: warning: leak of file descriptor '*sock' [CWE-775] [-Wanalyzer-fd-leak] 37 | if (err != 0) { | ^ 'try_bind_socket': events 1-8 | | 20 | *sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) when 'socket' succeeds | 21 | if (*sock < 0) { | | ~ | | | | | (2) following 'false' branch... |...... | 25 | if (setsockopt(*sock, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) < 0) { | | ~ ~ | | | | | | | (3) ...to here | | (4) following 'false' branch... |...... | 29 | err = bind(*sock, (struct sockaddr *)&addr, sizeof(addr)); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) ...to here | 30 | | 31 | if (err != 0) { | | ~ | | | | | (6) following 'false' branch (when 'err == 0')... |...... | 35 | err = listen(*sock, backlog); | | ~~~~~~~~~~~~~~~~~~~~~~ | | | | | (7) ...to here | 36 | | 37 | if (err != 0) { | | ~ | | | | | (8) '*sock' leaks here | this happens regardless of whether we have the (incorrect) close on line 41 or not ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param 2024-04-10 13:24 [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive levon at movementarian dot org @ 2024-04-10 16:49 ` dmalcolm at gcc dot gnu.org 2024-04-14 5:23 ` pinskia at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: dmalcolm at gcc dot gnu.org @ 2024-04-10 16:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114677 David Malcolm <dmalcolm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-04-10 Summary|apparent -Wanalyzer-fd-leak |[13/14 Regression] | false positive |-Wanalyzer-fd-leak false | |positive writing to int * | |param Ever confirmed|0 |1 --- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this bug. Confirmed (thanks for the godbolt link). Affects GCC 13 onwards (which added that warning) Looks like for some reason the analyzer isn't treating (*sock) as keeping the value of the fd alive. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param 2024-04-10 13:24 [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive levon at movementarian dot org 2024-04-10 16:49 ` [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param dmalcolm at gcc dot gnu.org @ 2024-04-14 5:23 ` pinskia at gcc dot gnu.org 2024-04-17 13:34 ` law at gcc dot gnu.org 2024-05-21 9:19 ` [Bug analyzer/114677] [13/14/15 " jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-14 5:23 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114677 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param 2024-04-10 13:24 [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive levon at movementarian dot org 2024-04-10 16:49 ` [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param dmalcolm at gcc dot gnu.org 2024-04-14 5:23 ` pinskia at gcc dot gnu.org @ 2024-04-17 13:34 ` law at gcc dot gnu.org 2024-05-21 9:19 ` [Bug analyzer/114677] [13/14/15 " jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: law at gcc dot gnu.org @ 2024-04-17 13:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114677 Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 CC| |law at gcc dot gnu.org ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug analyzer/114677] [13/14/15 Regression] -Wanalyzer-fd-leak false positive writing to int * param 2024-04-10 13:24 [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive levon at movementarian dot org ` (2 preceding siblings ...) 2024-04-17 13:34 ` law at gcc dot gnu.org @ 2024-05-21 9:19 ` jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jakub at gcc dot gnu.org @ 2024-05-21 9:19 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114677 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|13.3 |13.4 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- GCC 13.3 is being released, retargeting bugs to GCC 13.4. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-21 9:20 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-04-10 13:24 [Bug analyzer/114677] New: apparent -Wanalyzer-fd-leak false positive levon at movementarian dot org 2024-04-10 16:49 ` [Bug analyzer/114677] [13/14 Regression] -Wanalyzer-fd-leak false positive writing to int * param dmalcolm at gcc dot gnu.org 2024-04-14 5:23 ` pinskia at gcc dot gnu.org 2024-04-17 13:34 ` law at gcc dot gnu.org 2024-05-21 9:19 ` [Bug analyzer/114677] [13/14/15 " jakub 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).