From 7694d0352a92d9f91c7afa69df0a0e56f95a771b Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sun, 20 Aug 2023 20:02:43 +0200 Subject: [PATCH] Testsuite, darwin: Fix analyzer testcases On darwin, system headers are fortified by default and that defeats the analyzer's warnings on memcpy() calls. Turn this off for testing. gcc/testsuite/ChangeLog: * gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c: Use _FORTIFY_SOURCE=0 on darwin. * gcc.dg/plugin/taint-CVE-2011-0521-5.c: Likewise. * gcc.dg/plugin/taint-CVE-2011-0521-6.c: Likewise. --- gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c | 3 +++ gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c | 3 +++ gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c | 3 +++ 3 files changed, 9 insertions(+) diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c index 8cb067c6542..2e74770a7a3 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5-fixed.c @@ -4,6 +4,9 @@ /* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */ /* { dg-require-effective-target analyzer } */ +/* On darwin, system headers are fortified, which defeats the analysis. Turn it off. */ +/* { dg-additional-options "-D_FORTIFY_SOURCE=0" { target *-*-darwin* } } */ + /* See notes in this header. */ #include "taint-CVE-2011-0521.h" diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c index 4ce047902d3..021d458b66e 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-5.c @@ -4,6 +4,9 @@ /* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */ /* { dg-require-effective-target analyzer } */ +/* On darwin, system headers are fortified, which defeats the analysis. Turn it off. */ +/* { dg-additional-options "-D_FORTIFY_SOURCE=0" { target *-*-darwin* } } */ + /* See notes in this header. */ #include "taint-CVE-2011-0521.h" diff --git a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c index c54af790a56..f27e9eb5f02 100644 --- a/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c +++ b/gcc/testsuite/gcc.dg/plugin/taint-CVE-2011-0521-6.c @@ -4,6 +4,9 @@ /* { dg-options "-fanalyzer -fanalyzer-checker=taint --param=analyzer-max-svalue-depth=25" } */ /* { dg-require-effective-target analyzer } */ +/* On darwin, system headers are fortified, which defeats the analysis. Turn it off. */ +/* { dg-additional-options "-D_FORTIFY_SOURCE=0" { target *-*-darwin* } } */ + /* See notes in this header. */ #include "taint-CVE-2011-0521.h"