aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2023-06-21 11:04:04 -0700
committerIan Lance Taylor <iant@golang.org>2023-06-21 11:04:04 -0700
commit97e31a0a2a2d2273687fcdb4e5416aab1a2186e1 (patch)
treed5c1cae4de436a0fe54a5f0a2a197d309f3d654c /gcc/testsuite/gcc.dg/analyzer
parent6612f4f8cb9b0d5af18ec69ad04e56debc3e6ced (diff)
parent577223aebc7acdd31e62b33c1682fe54a622ae27 (diff)
downloadgcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.zip
gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.gz
gcc-97e31a0a2a2d2273687fcdb4e5416aab1a2186e1.tar.bz2
Merge from trunk revision 577223aebc7acdd31e62b33c1682fe54a622ae27.
Diffstat (limited to 'gcc/testsuite/gcc.dg/analyzer')
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/allocation-size-2.c24
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/atomic-builtins-1.c544
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/atomic-builtins-haproxy-proxy.c55
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/atomic-builtins-qemu-sockets.c18
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/atomic-types-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/coreutils-cksum-pr108664.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/data-model-4.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c3
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/flex-with-call-summaries.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/isatty-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-CWE-590-examples.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c2
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c6
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr101962.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr109439.c12
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/pr109577.c16
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/realloc-5.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/realloc-pr110014.c25
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c1
-rw-r--r--gcc/testsuite/gcc.dg/analyzer/torture/conftest-1.c2
30 files changed, 728 insertions, 13 deletions
diff --git a/gcc/testsuite/gcc.dg/analyzer/allocation-size-2.c b/gcc/testsuite/gcc.dg/analyzer/allocation-size-2.c
index 2cf64e9..eb770f7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/allocation-size-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/allocation-size-2.c
@@ -76,13 +76,13 @@ void *create_buffer(int32_t n)
return malloc(n);
}
-void test_7(int32_t n)
+void test_7(int32_t n)
{
int32_t *buf = create_buffer(n * sizeof (int32_t));
free (buf);
}
-void test_8(int32_t n)
+void test_8(int32_t n)
{
/* FIXME: At the moment, region_model::set_value (lhs, <return_value>)
is called at the src_node of the return edge. This edge has no stmts
@@ -98,13 +98,11 @@ void test_9 (void)
{
int32_t n;
scanf("%i", &n);
- /* n is a conjured_svalue. */
- void *ptr = malloc (n); /* { dg-message "'n' bytes" "note" } */
- int32_t *iptr = (int32_t *)ptr; /* { dg-line assign9 } */
+ /* n is a conjured_svalue without any constraint. We have to assume
+ that is a multiple of sizeof (int32_t *); see PR analyzer/110014. */
+ void *ptr = malloc (n);
+ int32_t *iptr = (int32_t *)ptr;
free (iptr);
-
- /* { dg-warning "allocated buffer size is not a multiple of the pointee's size \\\[CWE-131\\\]" "warning" { target *-*-* } assign9 } */
- /* { dg-message "'int32_t \\*' (\\\{aka '(long )?int \\*'\\\})? here; 'sizeof \\(int32_t (\\\{aka (long )?int\\\})?\\)' is '4'" "note" { target *-*-* } assign9 } */
}
void test_11 (void)
@@ -157,3 +155,13 @@ void test_13 (void)
else
free (ptr);
}
+
+int *test_14 (size_t n)
+{
+ int *ptr = NULL;
+ /* n is an initial_svalue and guarded such that there is no equiv_class
+ for n itself but only for a binop_svalue containing n. */
+ if (n % sizeof (int) == 0)
+ ptr = malloc (n);
+ return ptr;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-1.c b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-1.c
new file mode 100644
index 0000000..69eac3f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-1.c
@@ -0,0 +1,544 @@
+/* { dg-require-effective-target int128 } */
+/* { dg-require-effective-target sync_char_short } */
+/* { dg-require-effective-target sync_int_long_stack } */
+/* { dg-require-effective-target sync_int_long } */
+
+#include <stdint.h>
+
+#include "analyzer-decls.h"
+
+/* __atomic_exchange. */
+
+void test__atomic_exchange_on_int8 (int8_t i, int8_t j)
+{
+ int8_t orig_i = i;
+ int8_t orig_j = j;
+ int8_t ret;
+ __atomic_exchange (&i, &j, &ret, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_on_int16 (int16_t i, int16_t j)
+{
+ int16_t orig_i = i;
+ int16_t orig_j = j;
+ int16_t ret;
+ __atomic_exchange (&i, &j, &ret, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_on_int32 (int32_t i, int32_t j)
+{
+ int32_t orig_i = i;
+ int32_t orig_j = j;
+ int32_t ret;
+ __atomic_exchange (&i, &j, &ret, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_on_int64 (int64_t i, int64_t j)
+{
+ int64_t orig_i = i;
+ int64_t orig_j = j;
+ int64_t ret;
+ __atomic_exchange (&i, &j, &ret, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_on_int128 (__int128 i, __int128 j)
+{
+ __int128 orig_i = i;
+ __int128 orig_j = j;
+ __int128 ret;
+ __atomic_exchange (&i, &j, &ret, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_exchange_n. */
+
+void test__atomic_exchange_n_on_int8 (int8_t i, int8_t j)
+{
+ int8_t orig_i = i;
+ int8_t orig_j = j;
+ int8_t ret;
+ ret = __atomic_exchange_n (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_n_on_int16 (int16_t i, int16_t j)
+{
+ int16_t orig_i = i;
+ int16_t orig_j = j;
+ int16_t ret;
+ ret = __atomic_exchange_n (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_n_on_int32 (int32_t i, int32_t j)
+{
+ int32_t orig_i = i;
+ int32_t orig_j = j;
+ int32_t ret;
+ ret = __atomic_exchange_n (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_n_on_int64 (int64_t i, int64_t j)
+{
+ int64_t orig_i = i;
+ int64_t orig_j = j;
+ int64_t ret;
+ ret = __atomic_exchange_n (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_n_on_int128 (__int128 i, __int128 j)
+{
+ __int128 orig_i = i;
+ __int128 orig_j = j;
+ __int128 ret;
+ ret = __atomic_exchange_n (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_exchange_1 through __atomic_exchange_16. */
+
+void test__atomic_exchange_1 (int8_t i, int8_t j)
+{
+ int8_t orig_i = i;
+ int8_t orig_j = j;
+ int8_t ret;
+ ret = __atomic_exchange_1 (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_2 (int16_t i, int16_t j)
+{
+ int16_t orig_i = i;
+ int16_t orig_j = j;
+ int16_t ret;
+ ret = __atomic_exchange_2 (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_4 (int32_t i, int32_t j)
+{
+ int32_t orig_i = i;
+ int32_t orig_j = j;
+ int32_t ret;
+ ret = __atomic_exchange_4 (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_8 (int64_t i, int64_t j)
+{
+ int64_t orig_i = i;
+ int64_t orig_j = j;
+ int64_t ret;
+ ret = __atomic_exchange_8 (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_exchange_16 (__int128 i, __int128 j)
+{
+ __int128 orig_i = i;
+ __int128 orig_j = j;
+ __int128 ret;
+ ret = __atomic_exchange_16 (&i, j, 0);
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (i == orig_j); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_load. */
+
+void test__atomic_load_from_int8 (int8_t i)
+{
+ int8_t orig_i = i;
+ int8_t ret;
+ __atomic_load (&i, &ret, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_from_int16 (int16_t i)
+{
+ int16_t orig_i = i;
+ int16_t ret;
+ __atomic_load (&i, &ret, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_from_int32 (int32_t i)
+{
+ int32_t orig_i = i;
+ int32_t ret;
+ __atomic_load (&i, &ret, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_from_int64 (int64_t i)
+{
+ int64_t orig_i = i;
+ int64_t ret;
+ __atomic_load (&i, &ret, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_from_int1288 (__int128 i)
+{
+ __int128 orig_i = i;
+ __int128 ret;
+ __atomic_load (&i, &ret, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_load_n. */
+
+void test__atomic_load_n_from_int8 (int8_t i)
+{
+ int8_t orig_i = i;
+ int8_t ret;
+ ret = __atomic_load_n (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_n_from_int16 (int16_t i)
+{
+ int16_t orig_i = i;
+ int16_t ret;
+ ret = __atomic_load_n (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_n_from_int32 (int32_t i)
+{
+ int32_t orig_i = i;
+ int32_t ret;
+ ret = __atomic_load_n (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_n_from_int64 (int64_t i)
+{
+ int64_t orig_i = i;
+ int64_t ret;
+ ret = __atomic_load_n (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_n_from_int128 (__int128 i)
+{
+ __int128 orig_i = i;
+ __int128 ret;
+ ret = __atomic_load_n (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_load_1 through __atomic_load_16. */
+
+void test__atomic_load_1 (int8_t i)
+{
+ int8_t orig_i = i;
+ int8_t ret;
+ ret = __atomic_load_1 (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_2 (int16_t i)
+{
+ int16_t orig_i = i;
+ int16_t ret;
+ ret = __atomic_load_2 (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_4 (int32_t i)
+{
+ int32_t orig_i = i;
+ int32_t ret;
+ ret = __atomic_load_4 (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_8 (int64_t i)
+{
+ int64_t orig_i = i;
+ int64_t ret;
+ ret = __atomic_load_8 (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_load_16 (__int128 i)
+{
+ __int128 orig_i = i;
+ __int128 ret;
+ ret = __atomic_load_16 (&i, 0);
+ __analyzer_eval (i == orig_i); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_store_n_on_uint8 (uint8_t i)
+{
+ uint8_t tmp;
+ __atomic_store_n (&tmp, i, 0);
+ __analyzer_eval (tmp == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_store_n_on_uint16 (uint16_t i)
+{
+ uint16_t tmp;
+ __atomic_store_n (&tmp, i, 0);
+ __analyzer_eval (tmp == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_store_n_on_uint32 (uint32_t i)
+{
+ uint32_t tmp;
+ __atomic_store_n (&tmp, i, 0);
+ __analyzer_eval (tmp == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_store_n_on_uint64 (uint64_t i)
+{
+ uint64_t tmp;
+ __atomic_store_n (&tmp, i, 0);
+ __analyzer_eval (tmp == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_store_n_on_int128 (__int128 i)
+{
+ __int128 tmp;
+ __atomic_store_n (&tmp, i, 0);
+ __analyzer_eval (tmp == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_OP_fetch built-ins. */
+
+/* __atomic_add_fetch. */
+
+void test__atomic_add_fetch_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_add_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i + j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_add_fetch_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_add_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i + j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_sub_fetch. */
+
+void test__atomic_sub_fetch_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_sub_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i - j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_sub_fetch_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_sub_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i - j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_and_fetch. */
+
+void test__atomic_and_fetch_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_and_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i & j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_and_fetch_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_and_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i & j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_xor_fetch. */
+
+void test__atomic_xor_fetch_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_xor_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i ^ j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_xor_fetch_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_xor_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i ^ j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_or_fetch. */
+
+void test__atomic_or_fetch_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_or_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i | j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_or_fetch_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_or_fetch (&i, j, 0);
+ __analyzer_eval (i == (orig_i | j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_fetch_OP built-ins. */
+
+/* __atomic_fetch_add. */
+
+void test__atomic_fetch_add_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_fetch_add (&i, j, 0);
+ __analyzer_eval (i == (orig_i + j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_fetch_add_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_fetch_add (&i, j, 0);
+ __analyzer_eval (i == (orig_i + j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_fetch_sub. */
+
+void test__atomic_fetch_sub_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_fetch_sub (&i, j, 0);
+ __analyzer_eval (i == (orig_i - j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_fetch_sub_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_fetch_sub (&i, j, 0);
+ __analyzer_eval (i == (orig_i - j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_fetch_and. */
+
+void test__atomic_fetch_and_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_fetch_and (&i, j, 0);
+ __analyzer_eval (i == (orig_i & j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_fetch_and_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_fetch_and (&i, j, 0);
+ __analyzer_eval (i == (orig_i & j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_fetch_xor. */
+
+void test__atomic_fetch_xor_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_fetch_xor (&i, j, 0);
+ __analyzer_eval (i == (orig_i ^ j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_fetch_xor_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_fetch_xor (&i, j, 0);
+ __analyzer_eval (i == (orig_i ^ j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+/* __atomic_fetch_or. */
+
+void test__atomic_fetch_or_on_uint32_t (uint32_t i, uint32_t j)
+{
+ uint32_t orig_i = i;
+ uint32_t ret;
+ ret = __atomic_fetch_or (&i, j, 0);
+ __analyzer_eval (i == (orig_i | j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
+
+void test__atomic_fetch_or_on_uint64_t (uint64_t i, uint64_t j)
+{
+ uint64_t orig_i = i;
+ uint64_t ret;
+ ret = __atomic_fetch_or (&i, j, 0);
+ __analyzer_eval (i == (orig_i | j)); /* { dg-warning "TRUE" } */
+ __analyzer_eval (ret == orig_i); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-haproxy-proxy.c b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-haproxy-proxy.c
new file mode 100644
index 0000000..72953a5
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-haproxy-proxy.c
@@ -0,0 +1,55 @@
+/* Reduced from haproxy-2.7.1's proxy.c */
+
+/* { dg-require-effective-target sync_int_long_stack } */
+/* { dg-require-effective-target sync_int_long } */
+
+typedef __SIZE_TYPE__ size_t;
+
+extern void* malloc(size_t __size)
+ __attribute__((__nothrow__, __leaf__, __malloc__, __alloc_size__(1)));
+
+extern void free(void* __ptr) __attribute__((__nothrow__, __leaf__));
+
+struct error_snapshot
+{
+ /* [..snip...] */
+};
+
+struct proxy
+{
+ /* [..snip...] */
+ struct error_snapshot *invalid_req, *invalid_rep;
+ /* [..snip...] */
+};
+
+extern unsigned int error_snapshot_id;
+
+void
+proxy_capture_error(struct proxy* proxy,
+ int is_back)
+{
+ struct error_snapshot* es;
+ unsigned int ev_id;
+
+ /* [...snip...] */
+
+ ev_id = __atomic_fetch_add(&error_snapshot_id, 1, 5);
+
+ /* [...snip...] */
+
+ es = malloc(sizeof(*es));
+ if (!es)
+ return;
+
+ /* [...snip...] */
+
+ if (is_back) {
+ es = __atomic_exchange_n(&proxy->invalid_rep, es, 4); /* { dg-bogus "leak" } */
+ } else {
+ es = __atomic_exchange_n(&proxy->invalid_req, es, 4); /* { dg-bogus "leak" } */
+ }
+
+ /* [...snip...] */
+
+ free(es);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-qemu-sockets.c b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-qemu-sockets.c
new file mode 100644
index 0000000..cd90f8f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/atomic-builtins-qemu-sockets.c
@@ -0,0 +1,18 @@
+struct foo {
+ char placeholder[5];
+};
+
+void *
+test (const char *str)
+{
+ struct foo *p = __builtin_malloc(sizeof(struct foo));
+ if (!p)
+ return p;
+
+ __builtin_memset(p, 0, sizeof(*p));
+
+ static int s = 1;
+ __atomic_store_n(&s, 0, 0);
+
+ return p;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/atomic-types-1.c b/gcc/testsuite/gcc.dg/analyzer/atomic-types-1.c
new file mode 100644
index 0000000..536b649
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/atomic-types-1.c
@@ -0,0 +1,11 @@
+#include "analyzer-decls.h"
+
+_Atomic int i;
+
+void test_atomic_int_1(int x)
+{
+ i = x;
+ __analyzer_eval(i == x); /* { dg-warning "TRUE" } */
+ i++;
+ __analyzer_eval(i == x + 1); /* { dg-warning "TRUE" } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c b/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c
index 1e689b3..6e583d0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c
+++ b/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target int32plus } */
/* { dg-additional-options "-fanalyzer-call-summaries --param analyzer-min-snodes-for-call-summary=0" } */
/* There need to be at least two calls to a function for the
diff --git a/gcc/testsuite/gcc.dg/analyzer/coreutils-cksum-pr108664.c b/gcc/testsuite/gcc.dg/analyzer/coreutils-cksum-pr108664.c
index 27eef83..62698f3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/coreutils-cksum-pr108664.c
+++ b/gcc/testsuite/gcc.dg/analyzer/coreutils-cksum-pr108664.c
@@ -1,3 +1,6 @@
+/* { dg-require-effective-target int32plus } */
+/* { dg-require-effective-target size24plus } */
+
/* Reduced from coreutils's cksum.c: cksum_slice8 */
typedef long unsigned int size_t;
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/doom-s_sound-pr108867.c b/gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c
index ebbfed2..ae58f03 100644
--- a/gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c
+++ b/gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c
@@ -1,6 +1,7 @@
/* Reduced from Doom's linuxdoom-1.10/s_sound.c, which is GPLv2 or later. */
/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex" } */
+/* { dg-require-effective-target size32plus } */
typedef struct _IO_FILE FILE;
extern FILE* stderr;
diff --git a/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c b/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c
index cf273b2..b57b9fa 100644
--- a/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c
+++ b/gcc/testsuite/gcc.dg/analyzer/fd-access-mode-target-headers.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "" { powerpc*-*-aix* || newlib } } */
+/* { dg-skip-if "" { avr-*-* } } */
#include <sys/stat.h>
#include <fcntl.h>
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 2add3cb..9d125df 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>
diff --git a/gcc/testsuite/gcc.dg/analyzer/flex-with-call-summaries.c b/gcc/testsuite/gcc.dg/analyzer/flex-with-call-summaries.c
index 79f2f8e..45edacf 100644
--- a/gcc/testsuite/gcc.dg/analyzer/flex-with-call-summaries.c
+++ b/gcc/testsuite/gcc.dg/analyzer/flex-with-call-summaries.c
@@ -2,6 +2,7 @@
script. */
/* { dg-skip-if "" { powerpc*-*-aix* } } */
+/* { dg-skip-if "" { "avr-*-*" } } */
/* { dg-additional-options "-fanalyzer-call-summaries" } */
/* { dg-additional-options "-Wno-analyzer-too-complex" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/isatty-1.c b/gcc/testsuite/gcc.dg/analyzer/isatty-1.c
index 389d2cd..3bb12c0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/isatty-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/isatty-1.c
@@ -1,4 +1,5 @@
/* { dg-skip-if "" { powerpc*-*-aix* } } */
+/* { dg-skip-if "" { "avr-*-*" } } */
#include <errno.h>
#include "analyzer-decls.h"
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-CWE-590-examples.c b/gcc/testsuite/gcc.dg/analyzer/malloc-CWE-590-examples.c
index 036f888..9434f2d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-CWE-590-examples.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-CWE-590-examples.c
@@ -1,4 +1,5 @@
/* { dg-additional-options "-Wno-free-nonheap-object" } */
+/* { dg-require-effective-target size32plus } */
/* Examples adapted from https://cwe.mitre.org/data/definitions/590.html
which states "Copyright © 2006–2022, The MITRE Corporation. CWE, CWSS, CWRAF, and the CWE logo are trademarks of The MITRE Corporation."
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c b/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c
index 3d141b5..3d798e6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c
@@ -12,6 +12,8 @@ void test_1 (void)
/* Verify SARIF output.
+ { dg-final { verify-sarif-file } }
+
The threadFlowLocation objects should have "kinds" properties
reflecting the meanings of the events:
{ dg-final { scan-sarif-file "\"kinds\": \\\[\"acquire\", \"memory\"\\\]" } }
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c
index 12a0a48..3fe061b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c
+++ b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target ptr_eq_long } */
/* { dg-additional-options "-O2 -Wno-shift-count-overflow" } */
struct lisp;
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c
index 5108182..298e483 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target ptr_eq_long } */
/* { dg-additional-options "-O2 -Wno-shift-count-overflow" } */
struct lisp;
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c
index f6bf383..2b0ba29 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c
+++ b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c
@@ -1,3 +1,4 @@
+/* { dg-require-effective-target int32plus } */
/* { dg-additional-options "-Wno-analyzer-too-complex -O2" } */
typedef long int ptrdiff_t;
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c
index 2a9c715..cb46827 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early-O2.c
@@ -1,5 +1,6 @@
/* Reduced from haproxy's src/ssl_sample.c */
+/* { dg-require-effective-target ptr_eq_long } */
/* { dg-additional-options "-O2" } */
union sample_value {
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
index d83af19..fbacb6c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
+++ b/gcc/testsuite/gcc.dg/analyzer/null-deref-pr108251-smp_fetch_ssl_fc_has_early.c
@@ -1,5 +1,7 @@
/* Reduced from haproxy's src/ssl_sample.c */
+/* { dg-require-effective-target ptr_eq_long } */
+
union sample_value {
long long int sint;
/* [...snip...] */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
index 1330090..336f624 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-2.c
@@ -82,5 +82,4 @@ void test5 (void)
/* { dg-warning "heap-based buffer over-read" "bounds warning" { target *-*-* } test5 } */
/* { dg-message "read of 4 bytes from after the end of the region" "num bad bytes note" { target *-*-* } test5 } */
- /* { dg-warning "use of uninitialized value" "uninit warning" { target *-*-* } test5 } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
index 2a61d8c..568f9ca 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-5.c
@@ -68,7 +68,6 @@ void test8 (size_t size, size_t offset)
char dst[size];
memcpy (dst, src, size + offset); /* { dg-line test8 } */
/* { dg-warning "over-read" "warning" { target *-*-* } test8 } */
- /* { dg-warning "use of uninitialized value" "warning" { target *-*-* } test8 } */
/* { dg-warning "overflow" "warning" { target *-*-* } test8 } */
}
@@ -78,7 +77,6 @@ void test9 (size_t size, size_t offset)
int32_t dst[size];
memcpy (dst, src, 4 * size + 1); /* { dg-line test9 } */
/* { dg-warning "over-read" "warning" { target *-*-* } test9 } */
- /* { dg-warning "use of uninitialized value" "warning" { target *-*-* } test9 } */
/* { dg-warning "overflow" "warning" { target *-*-* } test9 } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c b/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
index a8546ea..60558a8 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
@@ -1,5 +1,7 @@
/* Example of pipe usage from glibc manual. */
+/* { dg-skip-if "" { "avr-*-*" } } */
+
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
@@ -13,6 +15,8 @@ read_from_pipe (int file)
FILE *stream;
int c;
stream = fdopen (file, "r");
+ if (stream == NULL)
+ exit (EXIT_FAILURE);
while ((c = fgetc (stream)) != EOF)
putchar (c);
fclose (stream);
@@ -25,6 +29,8 @@ write_to_pipe (int file)
{
FILE *stream;
stream = fdopen (file, "w");
+ if (stream == NULL)
+ exit (EXIT_FAILURE);
fprintf (stream, "hello, world!\n");
fprintf (stream, "goodbye, world!\n");
fclose (stream);
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr101962.c b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
index 08c0aba..b878aad 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr101962.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr101962.c
@@ -24,7 +24,6 @@ test_1 (void)
__analyzer_eval (a != NULL); /* { dg-warning "TRUE" } */
return *a; /* { dg-line test_1 } */
- /* { dg-warning "use of uninitialized value '\\*a'" "warning" { target *-*-* } test_1 } */
/* { dg-warning "stack-based buffer over-read" "warning" { target *-*-* } test_1 } */
}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr109439.c b/gcc/testsuite/gcc.dg/analyzer/pr109439.c
new file mode 100644
index 0000000..01c87cf
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr109439.c
@@ -0,0 +1,12 @@
+int would_like_only_oob (int i)
+{
+ int arr[] = {1,2,3,4,5,6,7};
+ arr[10] = 9; /* { dg-warning "stack-based buffer overflow" } */
+ arr[11] = 15; /* { dg-warning "stack-based buffer overflow" } */
+ int y1 = arr[9]; /* { dg-warning "stack-based buffer over-read" } */
+ /* { dg-bogus "use of uninitialized value" "" { target *-*-* } .-1 } */
+
+ arr[18] = 15; /* { dg-warning "stack-based buffer overflow" } */
+
+ return y1;
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr109577.c b/gcc/testsuite/gcc.dg/analyzer/pr109577.c
new file mode 100644
index 0000000..a6af6f7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/pr109577.c
@@ -0,0 +1,16 @@
+void *malloc (unsigned long);
+
+double *
+unsafe (unsigned long n)
+{
+ return malloc (n * sizeof (double));
+}
+
+double *
+safer (unsigned long n)
+{
+ unsigned long nbytes;
+ if (__builtin_mul_overflow (n, sizeof (double), &nbytes))
+ return 0;
+ return malloc (nbytes);
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/realloc-5.c b/gcc/testsuite/gcc.dg/analyzer/realloc-5.c
index 137e05b..f65f2c6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/realloc-5.c
+++ b/gcc/testsuite/gcc.dg/analyzer/realloc-5.c
@@ -40,7 +40,6 @@ void test_1 ()
/* { dg-warning "UNKNOWN" "warning" { target *-*-* } eval } */
/* { dg-warning "heap-based buffer over-read" "warning" { target *-*-* } eval } */
- /* { dg-warning "use of uninitialized value" "warning" { target *-*-* } eval } */
}
free (q);
diff --git a/gcc/testsuite/gcc.dg/analyzer/realloc-pr110014.c b/gcc/testsuite/gcc.dg/analyzer/realloc-pr110014.c
new file mode 100644
index 0000000..d76b878
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/analyzer/realloc-pr110014.c
@@ -0,0 +1,25 @@
+void *realloc (void *, unsigned long)
+ __attribute__((__nothrow__, __leaf__))
+ __attribute__((__warn_unused_result__)) __attribute__((__alloc_size__ (2)));
+
+long *
+slurp (long *buffer, unsigned long file_size)
+{
+ unsigned long cc;
+ if (!__builtin_add_overflow (file_size - file_size % sizeof (long),
+ 2 * sizeof (long), &cc))
+ buffer = realloc (buffer, cc);
+ return buffer;
+}
+
+long *
+slurp1 (long *buffer, unsigned long file_size)
+{
+ return realloc (buffer, file_size - file_size % sizeof (long));
+}
+
+long *
+slurp2 (long *buffer, unsigned long file_size)
+{
+ return realloc (buffer, (file_size / sizeof (long)) * sizeof (long));
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c b/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c
index 997cf56..ee156d4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c
+++ b/gcc/testsuite/gcc.dg/analyzer/sarif-pr107366.c
@@ -18,3 +18,4 @@ hwloc_apply_diff_one() {
}
}
+/* { dg-final { verify-sarif-file } } */
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;
;