public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7176] testsuite: filter out warning noise for CWE-1341 test
@ 2023-04-14  3:10 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2023-04-14  3:10 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:edc6659c97c4a747123b1150b372dc8e7a83a824

commit r13-7176-gedc6659c97c4a747123b1150b372dc8e7a83a824
Author: Jiufu Guo <guojiufu@linux.ibm.com>
Date:   Wed Apr 12 10:12:58 2023 +0800

    testsuite: filter out warning noise for CWE-1341 test
    
    The case file-CWE-1341-example.c checkes [CWE-1341](`double-fclose`).
    While on some systems, besides [CWE-1341], a message of [CWE-415] is
    also reported. On those systems, attribute `malloc` may be attached on
    fopen:
    ```
    # 258 "/usr/include/stdio.h" 3 4
    extern FILE *fopen (const char *__restrict __filename,
          const char *__restrict __modes)
      __attribute__ ((__malloc__)) __attribute__ ((__malloc__ (fclose, 1))) ;
    
    or say: __attribute_malloc__ __attr_dealloc_fclose __wur;
    ```
    
    See (PR analyzer/108722) for future fix in the analyzer.
    This workaround patch adds -Wno-analyzer-double-free to this case.
    
    gcc/testsuite/ChangeLog:
    
            PR analyzer/108722
            * gcc.dg/analyzer/file-CWE-1341-example.c: Update.

Diff:
---
 gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c b/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c
index 2add3cb109b..9d125dfefe5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c
+++ b/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c
@@ -19,6 +19,9 @@
 
    IN NO EVENT SHALL THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE MITRE CORPORATION, ITS BOARD OF TRUSTEES, OFFICERS, AGENTS, AND EMPLOYEES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE INFORMATION OR THE USE OR OTHER DEALINGS IN THE CWE.  */
 
+/* Checks double-fclose only, suppress CWE-415. (PR analyzer/108722).  */
+/* { dg-additional-options -Wno-analyzer-double-free } */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-04-14  3:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14  3:10 [gcc r13-7176] testsuite: filter out warning noise for CWE-1341 test Jiu Fu Guo

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