public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/110172] New: Leak false positives from -fanalyzer with -fexceptions (even on C code)
@ 2023-06-08 13:39 dmalcolm at gcc dot gnu.org
  2023-06-20 14:43 ` [Bug analyzer/110172] " dmalcolm at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2023-06-08 13:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110172

            Bug ID: 110172
           Summary: Leak false positives from -fanalyzer with -fexceptions
                    (even on C code)
           Product: gcc
           Version: 13.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: ---

As noted by Reddit user "kr90df" here:
https://www.reddit.com/r/C_Programming/comments/13wl8qi/improvements_to_static_analysis_in_the_gcc_13/jndkr80/
we get a false +ve from -Wanalyzer-va-list-leak on this C code when
-fexceptions is enabled:

#include <stdio.h>
#include <stdarg.h>

int printerr(char *msg, ...) 
{ 
    va_list ap;
    va_start(ap, msg);
    vfprintf(stderr, msg, ap);
    va_end(ap);

    return(-1);
}

See https://godbolt.org/z/zrxsrYE4j

<source>: In function 'printerr':
<source>:12:1: warning: missing call to 'va_end' [-Wanalyzer-va-list-leak]
   12 | }
      | ^
  'printerr': events 1-2
    |
    |    7 |     va_start(ap, msg);
    |      |     ^~~~~~~~
    |      |     |
    |      |     (1) 'va_start' called here
    |......
    |   12 | }
    |      | ~    
    |      | |
    |      | (2) missing call to 'va_end' to match 'va_start' at (1)
    |

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

end of thread, other threads:[~2023-06-20 15:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 13:39 [Bug analyzer/110172] New: Leak false positives from -fanalyzer with -fexceptions (even on C code) dmalcolm at gcc dot gnu.org
2023-06-20 14:43 ` [Bug analyzer/110172] " dmalcolm at gcc dot gnu.org
2023-06-20 15:35 ` xry111 at gcc dot gnu.org
2023-06-20 15:40 ` redi at gcc dot gnu.org
2023-06-20 15:46 ` xry111 at gcc dot gnu.org
2023-06-20 15:58 ` fw 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).