aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorChristophe Lyon <christophe.lyon@linaro.org>2023-05-23 09:20:05 +0000
committerChristophe Lyon <christophe.lyon@linaro.org>2023-05-25 05:50:40 +0000
commitc9a19621a07e246385ae075b61283140b23c3b5a (patch)
tree189e5d49804be907d65b79ce7201c424aa5c78c5 /gcc
parente11685f71a561007b36f02e5ef3f5154313b0d41 (diff)
downloadgcc-c9a19621a07e246385ae075b61283140b23c3b5a.zip
gcc-c9a19621a07e246385ae075b61283140b23c3b5a.tar.gz
gcc-c9a19621a07e246385ae075b61283140b23c3b5a.tar.bz2
testsuite, analyzer: Fix testcases with fclose
The gcc.dg/analyzer/data-model-4.c and gcc.dg/analyzer/torture/conftest-1.c fail with recent glibc headers and succeed with older headers. The new error message is: warning: use of possibly-NULL 'f' where non-null expected [CWE-690] [-Wanalyzer-possible-null-argument] Like similar previous fixes in this area, this patch updates the testcase so that this warning isn't reported. 2023-05-23 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ * gcc.dg/analyzer/data-model-4.c: Exit if fopen returns NULL. * gcc.dg/analyzer/torture/conftest-1.c: Likewise.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-4.c b/gcc/testsuite/gcc.dg/analyzer/data-model-4.c
index 33f9087..d41868d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-4.c
@@ -8,6 +8,8 @@ int
main ()
{
FILE *f = fopen ("conftest.out", "w");
+ if (f == NULL)
+ return 1;
return ferror (f) || fclose (f) != 0;
;
diff --git a/gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c b/gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c
index 0cf85f0..9631bcf 100644
--- a/gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c
@@ -3,6 +3,8 @@ int
main ()
{
FILE *f = fopen ("conftest.out", "w");
+ if (f == NULL)
+ return 1;
return ferror (f) || fclose (f) != 0;
;