Commit 8863f61c by David Malcolm

analyzer: ensure that all DejaGnu tests have unique names

gcc/testsuite/ChangeLog:
	* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Ensure that all
	test names are unique.
	* gcc.dg/analyzer/attribute-nonnull.c: Likewise.
	* gcc.dg/analyzer/conditionals-notrans.c: Likewise.
	* gcc.dg/analyzer/data-model-1.c: Likewise.
	* gcc.dg/analyzer/data-model-18.c: Likewise.
	* gcc.dg/analyzer/data-model-8.c: Likewise.
	* gcc.dg/analyzer/data-model-9.c: Likewise.
	* gcc.dg/analyzer/file-1.c: Likewise.
	* gcc.dg/analyzer/file-paths-1.c: Likewise.
	* gcc.dg/analyzer/loop-2.c: Likewise.
	* gcc.dg/analyzer/loop-2a.c: Likewise.
	* gcc.dg/analyzer/loop-4.c: Likewise.
	* gcc.dg/analyzer/loop.c: Likewise.
	* gcc.dg/analyzer/malloc-1.c: Likewise.
	* gcc.dg/analyzer/malloc-2.c: Likewise.
	* gcc.dg/analyzer/malloc-ipa-10.c: Likewise.
	* gcc.dg/analyzer/malloc-ipa-2.c: Likewise.
	* gcc.dg/analyzer/malloc-macro-separate-events.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-1.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-2.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-3.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-4.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-5.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-7.c: Likewise.
	* gcc.dg/analyzer/malloc-paths-9.c: Likewise.
	* gcc.dg/analyzer/operations.c: Likewise.
	* gcc.dg/analyzer/params.c: Likewise.
	* gcc.dg/analyzer/pattern-test-1.c: Likewise.
	* gcc.dg/analyzer/pattern-test-2.c: Likewise.
	* gcc.dg/analyzer/sensitive-1.c: Likewise.
	* gcc.dg/analyzer/switch.c: Likewise.
	* gcc.dg/analyzer/taint-1.c: Likewise.
	* gcc.dg/analyzer/unknown-fns.c: Likewise.
parent bec23876
2020-01-19 David Malcolm <dmalcolm@redhat.com>
* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Ensure that all
test names are unique.
* gcc.dg/analyzer/attribute-nonnull.c: Likewise.
* gcc.dg/analyzer/conditionals-notrans.c: Likewise.
* gcc.dg/analyzer/data-model-1.c: Likewise.
* gcc.dg/analyzer/data-model-18.c: Likewise.
* gcc.dg/analyzer/data-model-8.c: Likewise.
* gcc.dg/analyzer/data-model-9.c: Likewise.
* gcc.dg/analyzer/file-1.c: Likewise.
* gcc.dg/analyzer/file-paths-1.c: Likewise.
* gcc.dg/analyzer/loop-2.c: Likewise.
* gcc.dg/analyzer/loop-2a.c: Likewise.
* gcc.dg/analyzer/loop-4.c: Likewise.
* gcc.dg/analyzer/loop.c: Likewise.
* gcc.dg/analyzer/malloc-1.c: Likewise.
* gcc.dg/analyzer/malloc-2.c: Likewise.
* gcc.dg/analyzer/malloc-ipa-10.c: Likewise.
* gcc.dg/analyzer/malloc-ipa-2.c: Likewise.
* gcc.dg/analyzer/malloc-macro-separate-events.c: Likewise.
* gcc.dg/analyzer/malloc-paths-1.c: Likewise.
* gcc.dg/analyzer/malloc-paths-2.c: Likewise.
* gcc.dg/analyzer/malloc-paths-3.c: Likewise.
* gcc.dg/analyzer/malloc-paths-4.c: Likewise.
* gcc.dg/analyzer/malloc-paths-5.c: Likewise.
* gcc.dg/analyzer/malloc-paths-7.c: Likewise.
* gcc.dg/analyzer/malloc-paths-9.c: Likewise.
* gcc.dg/analyzer/operations.c: Likewise.
* gcc.dg/analyzer/params.c: Likewise.
* gcc.dg/analyzer/pattern-test-1.c: Likewise.
* gcc.dg/analyzer/pattern-test-2.c: Likewise.
* gcc.dg/analyzer/sensitive-1.c: Likewise.
* gcc.dg/analyzer/switch.c: Likewise.
* gcc.dg/analyzer/taint-1.c: Likewise.
* gcc.dg/analyzer/unknown-fns.c: Likewise.
2020-01-19 Hans-Peter Nilsson <hp@axis.com> 2020-01-19 Hans-Peter Nilsson <hp@axis.com>
* gcc.dg/torture/pr26515.c (cris*-*-*): Conditionalize * gcc.dg/torture/pr26515.c (cris*-*-*): Conditionalize
......
...@@ -11,8 +11,8 @@ void ...@@ -11,8 +11,8 @@ void
recvauth_common(krb5_data inbuf) recvauth_common(krb5_data inbuf)
{ {
free(inbuf.data); free(inbuf.data);
free(inbuf.data); /* { dg-warning "double-'free'" } */ free(inbuf.data); /* { dg-warning "double-'free'" "warning" } */
/* { dg-message "2 duplicates" "" { target *-*-* } .-1 } */ /* { dg-message "2 duplicates" "duplicates notification" { target *-*-* } .-1 } */
} }
void krb5_recvauth(krb5_data inbuf) void krb5_recvauth(krb5_data inbuf)
......
...@@ -20,8 +20,8 @@ void test_1 (void *p, void *q, void *r) ...@@ -20,8 +20,8 @@ void test_1 (void *p, void *q, void *r)
void test_1a (void *q, void *r) void test_1a (void *q, void *r)
{ {
void *p = NULL; void *p = NULL;
foo(p, q, r); /* { dg-warning "use of NULL 'p' where non-null expected" } */ foo(p, q, r); /* { dg-warning "use of NULL 'p' where non-null expected" "warning" } */
/* { dg-message "argument 1 \\('p'\\) NULL where non-null expected" "" { target *-*-* } .-1 } */ /* { dg-message "argument 1 \\('p'\\) NULL where non-null expected" "note" { target *-*-* } .-1 } */
} }
void test_2 (void *p, void *q, void *r) void test_2 (void *p, void *q, void *r)
...@@ -36,8 +36,8 @@ void test_3 (void *q, void *r) ...@@ -36,8 +36,8 @@ void test_3 (void *q, void *r)
{ {
void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */ void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */
foo(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */ foo(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */ /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */
foo(p, q, r); foo(p, q, r);
...@@ -48,8 +48,8 @@ void test_4 (void *q, void *r) ...@@ -48,8 +48,8 @@ void test_4 (void *q, void *r)
{ {
void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */ void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */
bar(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */ bar(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */ /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */
bar(p, q, r); bar(p, q, r);
...@@ -71,8 +71,8 @@ void test_5 (void *q, void *r) ...@@ -71,8 +71,8 @@ void test_5 (void *q, void *r)
{ {
void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */ void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */
bar_t cb = get_bar (); bar_t cb = get_bar ();
cb(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */ cb(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */ /* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "note" { target *-*-* } .-1 } */
/* TODO: do we want an event showing where cb is assigned "bar"? */ /* TODO: do we want an event showing where cb is assigned "bar"? */
cb(p, q, r); cb(p, q, r);
......
...@@ -7,15 +7,15 @@ void test (int i, int j) ...@@ -7,15 +7,15 @@ void test (int i, int j)
{ {
__analyzer_eval (i > 4); /* { dg-warning "TRUE" } */ __analyzer_eval (i > 4); /* { dg-warning "TRUE" } */
__analyzer_eval (i <= 4); /* { dg-warning "FALSE" } */ __analyzer_eval (i <= 4); /* { dg-warning "FALSE" } */
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i > 5); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i > 5); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i != 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i != 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i == 3); /* { dg-warning "FALSE" "" { xfail *-*-* } } */ __analyzer_eval (i == 3); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i != 4); /* { dg-warning "TRUE" } */ __analyzer_eval (i != 4); /* { dg-warning "TRUE" } */
__analyzer_eval (i == 4); /* { dg-warning "FALSE" } */ __analyzer_eval (i == 4); /* { dg-warning "FALSE" } */
...@@ -33,8 +33,8 @@ void test (int i, int j) ...@@ -33,8 +33,8 @@ void test (int i, int j)
else else
{ {
__analyzer_eval (j >= i); /* { dg-warning "TRUE" } */ __analyzer_eval (j >= i); /* { dg-warning "TRUE" } */
__analyzer_eval (j > 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (j > 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
} }
else else
...@@ -43,21 +43,21 @@ void test (int i, int j) ...@@ -43,21 +43,21 @@ void test (int i, int j)
__analyzer_eval (i <= 4); /* { dg-warning "TRUE" } */ __analyzer_eval (i <= 4); /* { dg-warning "TRUE" } */
__analyzer_eval (i > 3); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i > 3); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i > 5); /* { dg-warning "FALSE" "" { xfail *-*-* } } */ __analyzer_eval (i > 5); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i != 3); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i != 3); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 3); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i == 3); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i != 4); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i != 4); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 4); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i == 4); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 5); /* { dg-warning "FALSE" "" { xfail *-*-* } } */ __analyzer_eval (i == 5); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i != 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i != 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i < 5); /* { dg-warning "TRUE" } */ __analyzer_eval (i < 5); /* { dg-warning "TRUE" } */
__analyzer_eval (i <= 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i <= 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
} }
...@@ -68,12 +68,12 @@ void test_2 (int i, int j, int k) ...@@ -68,12 +68,12 @@ void test_2 (int i, int j, int k)
__analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */
if (j >= k) if (j >= k)
{ {
__analyzer_eval (i >= k); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i >= k); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
__analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */
if (k >= i) if (k >= i)
__analyzer_eval (i == k); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == k); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
} }
} }
...@@ -101,8 +101,8 @@ void test_range_int_gt_lt (int i) ...@@ -101,8 +101,8 @@ void test_range_int_gt_lt (int i)
{ {
if (i > 3) if (i > 3)
if (i < 5) if (i < 5)
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
void test_range_float_gt_lt (float f) void test_range_float_gt_lt (float f)
...@@ -116,8 +116,8 @@ void test_range_int_ge_lt (int i) ...@@ -116,8 +116,8 @@ void test_range_int_ge_lt (int i)
{ {
if (i >= 4) if (i >= 4)
if (i < 5) if (i < 5)
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
void test_range_float_ge_lt (float f) void test_range_float_ge_lt (float f)
...@@ -131,8 +131,8 @@ void test_range_int_gt_le (int i) ...@@ -131,8 +131,8 @@ void test_range_int_gt_le (int i)
{ {
if (i > 3) if (i > 3)
if (i <= 4) if (i <= 4)
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
void test_range_float_gt_le (float f) void test_range_float_gt_le (float f)
...@@ -146,14 +146,14 @@ void test_range_int_ge_le (int i) ...@@ -146,14 +146,14 @@ void test_range_int_ge_le (int i)
{ {
if (i >= 4) if (i >= 4)
if (i <= 4) if (i <= 4)
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
void test_range_float_ge_le (float f) void test_range_float_ge_le (float f)
{ {
if (f >= 4) if (f >= 4)
if (f <= 4) if (f <= 4)
__analyzer_eval (f == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (f == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
} }
...@@ -16,7 +16,7 @@ void test (int *p, int i, int j) ...@@ -16,7 +16,7 @@ void test (int *p, int i, int j)
__analyzer_eval (p[3] == 42); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (p[3] == 42); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (p[i] == 17); /* { dg-warning "TRUE" } */ __analyzer_eval (p[i] == 17); /* { dg-warning "TRUE" } */
__analyzer_eval (p[j] == 17); /* { dg-warning "UNKNOWN" "" { xfail *-*-* } } */ __analyzer_eval (p[j] == 17); /* { dg-warning "UNKNOWN" "desired" { xfail *-*-* } } */
/* { dg-bogus "TRUE" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "TRUE" "status quo" { xfail *-*-* } .-1 } */
// FIXME(xfails) ^^^ // FIXME(xfails) ^^^
} }
...@@ -21,6 +21,6 @@ void test (void) ...@@ -21,6 +21,6 @@ void test (void)
struct base *bp = (struct base *)&s; struct base *bp = (struct base *)&s;
__analyzer_eval (bp->i == 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (bp->i == 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
} }
...@@ -14,8 +14,8 @@ void test_1 (void) ...@@ -14,8 +14,8 @@ void test_1 (void)
struct foo *f = calloc (1, sizeof (struct foo)); struct foo *f = calloc (1, sizeof (struct foo));
if (f == NULL) if (f == NULL)
return; return;
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
free (f); free (f);
} }
...@@ -27,7 +27,7 @@ void test_2 (void) ...@@ -27,7 +27,7 @@ void test_2 (void)
if (f == NULL) if (f == NULL)
return; return;
memset (f, 0, sizeof (struct foo)); memset (f, 0, sizeof (struct foo));
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
free (f); free (f);
} }
...@@ -7,10 +7,10 @@ test_1 (const char *path) ...@@ -7,10 +7,10 @@ test_1 (const char *path)
if (!f) if (!f)
return; return;
fclose (f); /* { dg-message "\\(4\\) \\.\\.\\.to here" } */ fclose (f); /* { dg-message "\\(4\\) \\.\\.\\.to here" "to here" } */
/* { dg-message "\\(5\\) first 'fclose' here" "" { target *-*-* } .-1 } */ /* { dg-message "\\(5\\) first 'fclose' here" "first fclose" { target *-*-* } .-1 } */
fclose (f); /* { dg-warning "double 'fclose' of FILE 'f'" } */ fclose (f); /* { dg-warning "double 'fclose' of FILE 'f'" "warning" } */
/* { dg-message "second 'fclose' here; first 'fclose' was at \\(5\\)" "" { target *-*-* } .-1 } */ /* { dg-message "second 'fclose' here; first 'fclose' was at \\(5\\)" "second fclose" { target *-*-* } .-1 } */
} }
void void
...@@ -22,8 +22,8 @@ test_2 (const char *src, const char *dst) ...@@ -22,8 +22,8 @@ test_2 (const char *src, const char *dst)
FILE *f_out = fopen (src, "w"); FILE *f_out = fopen (src, "w");
if (!f_out) if (!f_out)
return; /* { dg-warning "leak of FILE 'f_in'" } */ return; /* { dg-warning "leak of FILE 'f_in'" "warning" } */
/* { dg-message "\\(7\\) 'f_in' leaks here; was opened at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(7\\) 'f_in' leaks here; was opened at \\(1\\)" "event" { target *-*-* } .-1 } */
fclose (f_out); fclose (f_out);
fclose (f_in); fclose (f_in);
......
...@@ -11,8 +11,8 @@ void f1 (const char *str) ...@@ -11,8 +11,8 @@ void f1 (const char *str)
while (fgets(buf, 10, fp) != NULL) /* { dg-message "following 'false' branch\\.\\.\\." } */ while (fgets(buf, 10, fp) != NULL) /* { dg-message "following 'false' branch\\.\\.\\." } */
{ {
} }
} /* { dg-warning "leak of FILE 'fp'" } */ } /* { dg-warning "leak of FILE 'fp'" "warning" } */
/* { dg-message "\\.\\.\\.to here" "" { target *-*-* } .-1 } */ /* { dg-message "\\.\\.\\.to here" "to here" { target *-*-* } .-1 } */
void f2(const char *str, int flag) void f2(const char *str, int flag)
{ {
...@@ -21,5 +21,5 @@ void f2(const char *str, int flag) ...@@ -21,5 +21,5 @@ void f2(const char *str, int flag)
if (flag) /* { dg-message "when 'flag == 0'" } */ if (flag) /* { dg-message "when 'flag == 0'" } */
fclose(fp); fclose(fp);
} /* { dg-warning "leak of FILE 'fp'" } */ } /* { dg-warning "leak of FILE 'fp'" "warning" } */
/* { dg-message "\\.\\.\\.to here" "" { target *-*-* } .-1 } */ /* { dg-message "\\.\\.\\.to here" "to here" { target *-*-* } .-1 } */
...@@ -29,8 +29,8 @@ void test(void) ...@@ -29,8 +29,8 @@ void test(void)
__analyzer_eval (s.i >= 256); /* { dg-warning "TRUE" } */ __analyzer_eval (s.i >= 256); /* { dg-warning "TRUE" } */
__analyzer_eval (s.i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (s.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */ /* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
......
...@@ -14,9 +14,9 @@ void test(void) ...@@ -14,9 +14,9 @@ void test(void)
for (u.i=0; u.i<256; u.i++) { for (u.i=0; u.i<256; u.i++) {
__analyzer_eval (u.i < 256); /* { dg-warning "TRUE" } */ __analyzer_eval (u.i < 256); /* { dg-warning "TRUE" "1st" } */
/* { dg-warning "TRUE" "" { xfail *-*-* } .-1 } */ /* { dg-warning "TRUE" "2nd" { xfail *-*-* } .-1 } */
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-2 } */ /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-2 } */
/* (should report TRUE twice). */ /* (should report TRUE twice). */
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */
...@@ -29,11 +29,11 @@ void test(void) ...@@ -29,11 +29,11 @@ void test(void)
//__analyzer_eval (u.i >= 0); /* { d-todo-g-warning "TRUE" } */ //__analyzer_eval (u.i >= 0); /* { d-todo-g-warning "TRUE" } */
} }
__analyzer_eval (u.i >= 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (u.i >= 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
__analyzer_eval (u.i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (u.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */ /* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
......
...@@ -13,15 +13,15 @@ void test(void) ...@@ -13,15 +13,15 @@ void test(void)
for (i=0; i<256; i++) { for (i=0; i<256; i++) {
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" } */ __analyzer_eval (i >= 0); /* { dg-warning "TRUE" "true" } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
__analyzer_eval (i < 256); /* { dg-warning "TRUE" } */ __analyzer_eval (i < 256); /* { dg-warning "TRUE" } */
for (j=0; j<256; j++) { for (j=0; j<256; j++) {
__analyzer_eval (j >= 0); /* { dg-warning "TRUE" } */ __analyzer_eval (j >= 0); /* { dg-warning "TRUE" "true" } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
__analyzer_eval (j < 256); /* { dg-warning "TRUE" } */ __analyzer_eval (j < 256); /* { dg-warning "TRUE" } */
...@@ -29,8 +29,8 @@ void test(void) ...@@ -29,8 +29,8 @@ void test(void)
for (k=0; k<256; k++) { for (k=0; k<256; k++) {
__analyzer_eval (k >= 0); /* { dg-warning "TRUE" } */ __analyzer_eval (k >= 0); /* { dg-warning "TRUE" "true" } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
__analyzer_eval (k < 256); /* { dg-warning "TRUE" } */ __analyzer_eval (k < 256); /* { dg-warning "TRUE" } */
......
...@@ -12,14 +12,14 @@ void test(void) ...@@ -12,14 +12,14 @@ void test(void)
__analyzer_eval (i < 256); /* { dg-warning "TRUE" } */ __analyzer_eval (i < 256); /* { dg-warning "TRUE" } */
/* (should report TRUE twice). */ /* (should report TRUE twice). */
__analyzer_eval (i == 0); /* { dg-warning "TRUE" } */ __analyzer_eval (i == 0); /* { dg-warning "TRUE" "1st" } */
/* { dg-warning "FALSE" "" { xfail *-*-* } .-1 } */ /* { dg-warning "FALSE" "2nd" { xfail *-*-* } .-1 } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-2 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */
/* TODO(xfail^^^): ideally we ought to figure out i > 0 after 1st iteration. */ /* TODO(xfail^^^): ideally we ought to figure out i > 0 after 1st iteration. */
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" } */ __analyzer_eval (i >= 0); /* { dg-warning "TRUE" "1st" } */
/* { dg-warning "TRUE" "" { xfail *-*-* } } */ /* { dg-warning "TRUE" "2nd" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-2 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */
/* TODO(xfail^^^): ideally we ought to figure out i >= 0 for all iterations. */ /* TODO(xfail^^^): ideally we ought to figure out i >= 0 for all iterations. */
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */ __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */
...@@ -27,8 +27,8 @@ void test(void) ...@@ -27,8 +27,8 @@ void test(void)
__analyzer_eval (i >= 256); /* { dg-warning "TRUE" } */ __analyzer_eval (i >= 256); /* { dg-warning "TRUE" } */
__analyzer_eval (i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail^^^): it only figures out i >= 256, rather than i == 256. */ /* TODO(xfail^^^): it only figures out i >= 256, rather than i == 256. */
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */ __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
......
...@@ -474,8 +474,8 @@ test_41 (int flag) ...@@ -474,8 +474,8 @@ test_41 (int flag)
buffer = NULL; buffer = NULL;
} }
buffer[0] = 'a'; /* { dg-warning "dereference of possibly-NULL 'buffer'" } */ buffer[0] = 'a'; /* { dg-warning "dereference of possibly-NULL 'buffer'" "possibly-NULL" } */
/* { dg-warning "dereference of NULL 'buffer'" "" { target *-*-* } .-1 } */ /* { dg-warning "dereference of NULL 'buffer'" "NULL" { target *-*-* } .-1 } */
return buffer; return buffer;
} }
......
...@@ -9,15 +9,15 @@ extern char *strcpy(char *__restrict __dest, const char *__restrict __src) ...@@ -9,15 +9,15 @@ extern char *strcpy(char *__restrict __dest, const char *__restrict __src)
void test_1 (void) void test_1 (void)
{ {
void *p = malloc (1024); /* { dg-message "\\(1\\) this call could return NULL" } */ void *p = malloc (1024); /* { dg-message "\\(1\\) this call could return NULL" } */
strcpy ((char *)p, "hello world"); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */ strcpy ((char *)p, "hello world"); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" "warning" } */
/* { dg-message "\\(2\\) argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "event" { target *-*-* } .-1 } */
free (p); free (p);
} }
int *test_2 (void) int *test_2 (void)
{ {
int *i = malloc (sizeof (int)); /* { dg-message "\\(1\\) this call could return NULL" } */ int *i = malloc (sizeof (int)); /* { dg-message "\\(1\\) this call could return NULL" } */
*i = 42; /* { dg-warning "dereference of possibly-NULL 'i'" } */ *i = 42; /* { dg-warning "dereference of possibly-NULL 'i'" "warning" } */
/* { dg-message "\\(2\\) 'i' could be NULL: unchecked value from \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) 'i' could be NULL: unchecked value from \\(1\\)" "event" { target *-*-* } .-1 } */
return i; return i;
} }
#include <stdlib.h> #include <stdlib.h>
void void
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" } */ calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" "event 3" } */
/* { dg-message "\\(7\\) entry to 'calls_free'" "" { target *-*-* } .-1 } */ /* { dg-message "\\(7\\) entry to 'calls_free'" "event 7" { target *-*-* } .-1 } */
{ {
free (victim); /* { dg-warning "double-'free' of 'victim'" } */ free (victim); /* { dg-warning "double-'free' of 'victim'" "warning" } */
/* { dg-message "\\(4\\) first 'free' here" "" { target *-*-* } .-1 } */ /* { dg-message "\\(4\\) first 'free' here" "event 4" { target *-*-* } .-1 } */
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "" { target *-*-* } .-2 } */ /* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "event 8" { target *-*-* } .-2 } */
/* TODO: would this be better emitted at the callsite, /* TODO: would this be better emitted at the callsite,
for such a simple wrapper? */ for such a simple wrapper? */
...@@ -21,8 +21,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */ ...@@ -21,8 +21,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */
{ {
do_stuff (); do_stuff ();
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" } */ calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" "event 2" } */
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "" { target *-*-* } .-1 } */ /* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "event 5" { target *-*-* } .-1 } */
do_stuff (); do_stuff ();
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
#include <stdlib.h> #include <stdlib.h>
void void
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" } */ calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" "event 3" } */
/* { dg-message "\\(7\\) entry to 'calls_free'" "" { target *-*-* } .-1 } */ /* { dg-message "\\(7\\) entry to 'calls_free'" "event 7" { target *-*-* } .-1 } */
{ {
free (victim); /* { dg-warning "double-'free' of 'victim'" } */ free (victim); /* { dg-warning "double-'free' of 'victim'" "warning" } */
/* { dg-message "\\(4\\) first 'free' here" "" { target *-*-* } .-1 } */ /* { dg-message "\\(4\\) first 'free' here" "event 4" { target *-*-* } .-1 } */
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "" { target *-*-* } .-2 } */ /* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "event 8" { target *-*-* } .-2 } */
/* TODO: would this be better emitted at the callsite, /* TODO: would this be better emitted at the callsite,
for such a simple wrapper? */ for such a simple wrapper? */
...@@ -20,8 +20,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */ ...@@ -20,8 +20,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */
{ {
do_stuff (); do_stuff ();
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" } */ calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" "event 2" } */
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "" { target *-*-* } .-1 } */ /* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "event 5" { target *-*-* } .-1 } */
do_stuff (); do_stuff ();
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "malloc-macro.h" #include "malloc-macro.h"
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } 2 } */ /* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } 2 } */
/* { dg-message "first 'free' here" "" { target *-*-* } 2 } */ /* { dg-message "first 'free' here" "1st free event" { target *-*-* } 2 } */
/* { dg-message "second 'free' here" "" { target *-*-* } 2 } */ /* { dg-message "second 'free' here" "2nd free event" { target *-*-* } 2 } */
int test (void *ptr) int test (void *ptr)
{ {
......
...@@ -8,8 +8,8 @@ void test_1 (void) ...@@ -8,8 +8,8 @@ void test_1 (void)
free (ptr); /* { dg-line first_free } */ free (ptr); /* { dg-line first_free } */
free (ptr); /* { dg-line second_free } */ free (ptr); /* { dg-line second_free } */
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } second_free } */ /* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } second_free } */
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc } */ /* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc } */
/* { dg-message "\\(2\\) first 'free' here" "" { target *-*-* } first_free } */ /* { dg-message "\\(2\\) first 'free' here" "event 2" { target *-*-* } first_free } */
/* { dg-message "\\(3\\) second 'free' here; first 'free' was at \\(2\\)" "" { target *-*-* } second_free } */ /* { dg-message "\\(3\\) second 'free' here; first 'free' was at \\(2\\)" "event 3" { target *-*-* } second_free } */
} }
...@@ -7,7 +7,7 @@ void test_2 (void *ptr) ...@@ -7,7 +7,7 @@ void test_2 (void *ptr)
free (ptr); /* { dg-line first_free } */ free (ptr); /* { dg-line first_free } */
free (ptr); /* { dg-line second_free } */ free (ptr); /* { dg-line second_free } */
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } second_free } */ /* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } second_free } */
/* { dg-message "\\(1\\) first 'free' here" "" { target *-*-* } first_free } */ /* { dg-message "\\(1\\) first 'free' here" "event 1" { target *-*-* } first_free } */
/* { dg-message "\\(2\\) second 'free' here; first 'free' was at \\(1\\)" "" { target *-*-* } second_free } */ /* { dg-message "\\(2\\) second 'free' here; first 'free' was at \\(1\\)" "event 2" { target *-*-* } second_free } */
} }
...@@ -8,7 +8,7 @@ int *test_3 (void) ...@@ -8,7 +8,7 @@ int *test_3 (void)
*ptr = 42; /* { dg-line unchecked_deref } */ *ptr = 42; /* { dg-line unchecked_deref } */
return ptr; return ptr;
/* { dg-warning "dereference of possibly-NULL 'ptr'" "" { target *-*-* } unchecked_deref } */ /* { dg-warning "dereference of possibly-NULL 'ptr'" "warning" { target *-*-* } unchecked_deref } */
/* { dg-message "\\(1\\) this call could return NULL" "" { target *-*-* } malloc } */ /* { dg-message "\\(1\\) this call could return NULL" "event 1" { target *-*-* } malloc } */
/* { dg-message "\\(2\\) 'ptr' could be NULL" "" { target *-*-* } unchecked_deref } */ /* { dg-message "\\(2\\) 'ptr' could be NULL" "event 2" { target *-*-* } unchecked_deref } */
} }
...@@ -11,10 +11,10 @@ int *test_4 (void) ...@@ -11,10 +11,10 @@ int *test_4 (void)
*ptr = 43; /* { dg-line on_null_ptr } */ *ptr = 43; /* { dg-line on_null_ptr } */
return ptr; return ptr;
/* { dg-warning "dereference of NULL 'ptr'" "" { target *-*-* } on_null_ptr } */ /* { dg-warning "dereference of NULL 'ptr'" "warning" { target *-*-* } on_null_ptr } */
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc } */ /* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc } */
/* { dg-message "\\(2\\) assuming 'ptr' is NULL" "" { target *-*-* } cond } */ /* { dg-message "\\(2\\) assuming 'ptr' is NULL" "event 2" { target *-*-* } cond } */
/* { dg-message "\\(3\\) following 'false' branch \\(when 'ptr' is NULL\\)\\.\\.\\." "" { target *-*-* } cond } */ /* { dg-message "\\(3\\) following 'false' branch \\(when 'ptr' is NULL\\)\\.\\.\\." "event 3" { target *-*-* } cond } */
/* { dg-message "\\(4\\) \\.\\.\\.to here" "" { target *-*-* } on_null_ptr } */ /* { dg-message "\\(4\\) \\.\\.\\.to here" "event 4" { target *-*-* } on_null_ptr } */
/* { dg-message "\\(5\\) dereference of NULL 'ptr'" "" { target *-*-* } on_null_ptr } */ /* { dg-message "\\(5\\) dereference of NULL 'ptr'" "event 5" { target *-*-* } on_null_ptr } */
} }
...@@ -29,15 +29,15 @@ int test (const char *filename, int flag) ...@@ -29,15 +29,15 @@ int test (const char *filename, int flag)
free (q); free (q);
return 0; return 0;
/* { dg-warning "double-'free' of 'p'" "" { target *-*-* } second_free_of_p } */ /* { dg-warning "double-'free' of 'p'" "warning" { target *-*-* } second_free_of_p } */
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc_of_p } */ /* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc_of_p } */
/* { dg-message "\\(2\\) assuming 'p' is non-NULL" "" { target *-*-* } test_of_p } */ /* { dg-message "\\(2\\) assuming 'p' is non-NULL" "event 2" { target *-*-* } test_of_p } */
/* { dg-message "\\(3\\) following 'false' branch \\(when 'p' is non-NULL\\)\\.\\.\\." "" { target *-*-* } test_of_p } */ /* { dg-message "\\(3\\) following 'false' branch \\(when 'p' is non-NULL\\)\\.\\.\\." "event 3" { target *-*-* } test_of_p } */
/* { dg-message "\\(4\\) \\.\\.\\.to here" "" { target *-*-* } malloc_of_q } */ /* { dg-message "\\(4\\) \\.\\.\\.to here" "event 4" { target *-*-* } malloc_of_q } */
/* { dg-message "\\(5\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." "" { target *-*-* } test_of_q } */ /* { dg-message "\\(5\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." "event 5" { target *-*-* } test_of_q } */
/* { dg-message "\\(6\\) \\.\\.\\.to here" "" { target *-*-* } first_free_of_p } */ /* { dg-message "\\(6\\) \\.\\.\\.to here" "event 6" { target *-*-* } first_free_of_p } */
/* { dg-message "\\(7\\) first 'free' here" "" { target *-*-* } first_free_of_p } */ /* { dg-message "\\(7\\) first 'free' here" "event 7" { target *-*-* } first_free_of_p } */
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(7\\)" "" { target *-*-* } second_free_of_p } */ /* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(7\\)" "event 8" { target *-*-* } second_free_of_p } */
/* We don't care about the state changes to q. */ /* We don't care about the state changes to q. */
} }
...@@ -12,8 +12,8 @@ void test (void) ...@@ -12,8 +12,8 @@ void test (void)
if (!q) /* { dg-message "\\(2\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." } */ if (!q) /* { dg-message "\\(2\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." } */
{ {
free (q); /* { dg-message "\\(3\\) \\.\\.\\.to here" } */ free (q); /* { dg-message "\\(3\\) \\.\\.\\.to here" } */
return; /* { dg-warning "leak of 'p'" } */ return; /* { dg-warning "leak of 'p'" "warning" } */
/* { dg-message "\\(4\\) 'p' leaks here; was allocated at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(4\\) 'p' leaks here; was allocated at \\(1\\)" "event" { target *-*-* } .-1 } */
} }
bar (); bar ();
free (q); free (q);
......
...@@ -111,9 +111,9 @@ int test_3 (int x, int y) ...@@ -111,9 +111,9 @@ int test_3 (int x, int y)
if (y) if (y)
free (ptr); /* No double-'free' warning: we've already attempted free (ptr); /* No double-'free' warning: we've already attempted
to dereference it above. */ to dereference it above. */
return *ptr; /* { dg-warning "use after 'free' of 'ptr'" } */ return *ptr; /* { dg-warning "use after 'free' of 'ptr'" "use-after-free" } */
// TODO: two warnings here: one is from sm-malloc, the other from region model // TODO: two warnings here: one is from sm-malloc, the other from region model
/* { dg-warning "leak of 'ptr'" "" { target *-*-* } .-2 } */ /* { dg-warning "leak of 'ptr'" "leak" { target *-*-* } .-2 } */
} }
/* "dereference of possibly-NULL 'ptr'". */ /* "dereference of possibly-NULL 'ptr'". */
......
...@@ -9,26 +9,26 @@ void test (int i, int j) ...@@ -9,26 +9,26 @@ void test (int i, int j)
i += 3; i += 3;
__analyzer_eval (i > 45); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 45); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): do we really know this? what about overflow? */ /* TODO(xfail): do we really know this? what about overflow? */
i -= 1; i -= 1;
__analyzer_eval (i > 44); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 44); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): do we really know this? what about overflow? */ /* TODO(xfail): do we really know this? what about overflow? */
i = 3 * i; i = 3 * i;
__analyzer_eval (i > 132); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 132); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): do we really know this? what about overflow? */ /* TODO(xfail): do we really know this? what about overflow? */
i /= 2; i /= 2;
__analyzer_eval (i > 66); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 66); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): do we really know this? what about overflow? */ /* TODO(xfail): do we really know this? what about overflow? */
/* We don't know anything about j, so we don't know anything about k: */ /* We don't know anything about j, so we don't know anything about k: */
...@@ -37,8 +37,8 @@ void test (int i, int j) ...@@ -37,8 +37,8 @@ void test (int i, int j)
/* However, we should now know that m > 67: */ /* However, we should now know that m > 67: */
m = i + 1; m = i + 1;
__analyzer_eval (m > 67); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (m > 67); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): do we really know this? what about overflow? */ /* TODO(xfail): do we really know this? what about overflow? */
} }
} }
...@@ -8,8 +8,8 @@ static int called_function(int j) ...@@ -8,8 +8,8 @@ static int called_function(int j)
k = j - 1; k = j - 1;
__analyzer_eval (k > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (k > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): we're not then updating based on the assignment. */ /* TODO(xfail): we're not then updating based on the assignment. */
return k; return k;
...@@ -25,8 +25,8 @@ void test(int i) ...@@ -25,8 +25,8 @@ void test(int i)
i = called_function(i); i = called_function(i);
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */ __analyzer_eval (i > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail): we're not updating from the returned value. */ /* TODO(xfail): we're not updating from the returned value. */
} }
......
...@@ -7,8 +7,8 @@ extern void bar(void *); ...@@ -7,8 +7,8 @@ extern void bar(void *);
void test1(void *ptr) void test1(void *ptr)
{ {
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" } */ if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" "ptr != 0" } */
/* { dg-warning "pattern match on 'ptr == 0'" "" { target *-*-* } .-1 } */ /* { dg-warning "pattern match on 'ptr == 0'" "ptr == 0" { target *-*-* } .-1 } */
foo(ptr); foo(ptr);
} else { } else {
bar(ptr); bar(ptr);
...@@ -21,8 +21,8 @@ void test_2 (void *p, void *q) ...@@ -21,8 +21,8 @@ void test_2 (void *p, void *q)
return; return;
foo(p); foo(p);
/* { dg-warning "pattern match on 'p == 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'p == 0'" "p == 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'q == 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'q == 0'" "q == 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'p != 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'q != 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
} }
...@@ -8,8 +8,8 @@ extern void bar(void *); ...@@ -8,8 +8,8 @@ extern void bar(void *);
void test1(void *ptr) void test1(void *ptr)
{ {
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" } */ if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" "ptr != 0" } */
/* { dg-warning "pattern match on 'ptr == 0'" "" { target *-*-* } .-1 } */ /* { dg-warning "pattern match on 'ptr == 0'" "ptr == 0" { target *-*-* } .-1 } */
foo(ptr); foo(ptr);
} else { } else {
bar(ptr); bar(ptr);
...@@ -22,8 +22,8 @@ void test_2 (void *p, void *q) ...@@ -22,8 +22,8 @@ void test_2 (void *p, void *q)
return; return;
foo(p); foo(p);
/* { dg-warning "pattern match on '<unknown> == 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on '<unknown> == 0'" "<unknown> == 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on '<unknown> != 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on '<unknown> != 0'" "<unknown> != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'p != 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
/* { dg-warning "pattern match on 'q != 0'" "" { target *-*-* } cond_2 } */ /* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
} }
...@@ -5,29 +5,29 @@ ...@@ -5,29 +5,29 @@
char test_1 (FILE *logfile) char test_1 (FILE *logfile)
{ {
char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */ char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */
fprintf (logfile, "got password %s\n", password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" } */ fprintf (logfile, "got password %s\n", password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" "warning" } */
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "event" { target *-*-* } .-1 } */
} }
char test_2 (FILE *logfile, int i) char test_2 (FILE *logfile, int i)
{ {
char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */ char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */
fprintf (logfile, "got password[%i]: %s\n", i, password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" } */ fprintf (logfile, "got password[%i]: %s\n", i, password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" } */
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "event" { target *-*-* } .-1 } */
} }
char test_3 (FILE *logfile) char test_3 (FILE *logfile)
{ {
char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */ char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */
printf ("got password %s\n", password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" } */ printf ("got password %s\n", password); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" "warning" } */
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "event" { target *-*-* } .-1 } */
} }
char test_4 (FILE *logfile) char test_4 (FILE *logfile)
{ {
char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */ char *password = getpass (">"); /* { dg-message "\\(1\\) sensitive value acquired here" } */
fwrite (password, strlen (password), 1, logfile); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" } */ fwrite (password, strlen (password), 1, logfile); /* { dg-warning "sensitive value 'password' written to output file \\\[CWE-532\\\]" "warning" } */
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "event" { target *-*-* } .-1 } */
} }
static void called_by_test_5 (const char *value) static void called_by_test_5 (const char *value)
......
...@@ -19,8 +19,8 @@ void test (int i) ...@@ -19,8 +19,8 @@ void test (int i)
__analyzer_eval (i == 0); /* { dg-warning "FALSE" } */ __analyzer_eval (i == 0); /* { dg-warning "FALSE" } */
__analyzer_eval (i == 2); /* { dg-warning "UNKNOWN" } */ __analyzer_eval (i == 2); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (i == 3); /* { dg-warning "FALSE" } */ __analyzer_eval (i == 3); /* { dg-warning "FALSE" } */
__analyzer_eval (i == 4); /* { dg-warning "FALSE" "" { xfail *-*-* } } */ __analyzer_eval (i == 4); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */ /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
/* TODO(xfail^^^): we're only checking against endpoints of case /* TODO(xfail^^^): we're only checking against endpoints of case
ranges, not the insides. */ ranges, not the insides. */
__analyzer_eval (i == 5); /* { dg-warning "FALSE" } */ __analyzer_eval (i == 5); /* { dg-warning "FALSE" } */
......
...@@ -12,14 +12,14 @@ char test_1(FILE *f) ...@@ -12,14 +12,14 @@ char test_1(FILE *f)
{ {
struct foo tmp; struct foo tmp;
if (1 == fread(&tmp, sizeof(tmp), 1, f)) { /* { dg-message "\\(1\\) 'tmp' gets an unchecked value here" } */ if (1 == fread(&tmp, sizeof(tmp), 1, f)) { /* { dg-message "\\(1\\) 'tmp' gets an unchecked value here" "event 1" } */
/* { dg-message "\\(2\\) following 'true' branch\\.\\.\\." "" { target *-*-* } .-1 } */ /* { dg-message "\\(2\\) following 'true' branch\\.\\.\\." "event 2" { target *-*-* } .-1 } */
/* BUG: the following array lookup trusts that the input data's index is /* BUG: the following array lookup trusts that the input data's index is
in the range 0 <= i < 256; otherwise it's accessing the stack */ in the range 0 <= i < 256; otherwise it's accessing the stack */
return tmp.buf[tmp.i]; // { dg-warning "use of tainted value 'tmp.i' in array lookup without bounds checking" } */ return tmp.buf[tmp.i]; // { dg-warning "use of tainted value 'tmp.i' in array lookup without bounds checking" "warning" } */
/* { dg-message "23: \\(3\\) \\.\\.\\.to here" "" { target *-*-* } .-1 } */ /* { dg-message "23: \\(3\\) \\.\\.\\.to here" "event 3" { target *-*-* } .-1 } */
/* { dg-message "23: \\(4\\) 'tmp.i' has an unchecked value here \\(from 'tmp'\\)" "" { target *-*-* } .-2 } */ /* { dg-message "23: \\(4\\) 'tmp.i' has an unchecked value here \\(from 'tmp'\\)" "event 4" { target *-*-* } .-2 } */
/* { dg-message "\\(5\\) use of tainted value 'tmp.i' in array lookup without bounds checking" "" { target *-*-* } .-3 } */ /* { dg-message "\\(5\\) use of tainted value 'tmp.i' in array lookup without bounds checking" "event 5" { target *-*-* } .-3 } */
// TOOD: better messages for state changes // TOOD: better messages for state changes
} }
...@@ -50,8 +50,8 @@ char test_4(FILE *f) ...@@ -50,8 +50,8 @@ char test_4(FILE *f)
struct foo tmp; struct foo tmp;
if (1 == fread(&tmp, sizeof(tmp), 1, f)) { if (1 == fread(&tmp, sizeof(tmp), 1, f)) {
if (tmp.i >= 0) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" } */ if (tmp.i >= 0) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" "warning" } */
/* { dg-message "'tmp.i' has its lower bound checked here" "" { target *-*-* } .-1 } */ /* { dg-message "'tmp.i' has its lower bound checked here" "event" { target *-*-* } .-1 } */
return tmp.buf[tmp.i]; /* { dg-warning "use of tainted value 'tmp.i' in array lookup without upper-bounds checking" } */ return tmp.buf[tmp.i]; /* { dg-warning "use of tainted value 'tmp.i' in array lookup without upper-bounds checking" } */
} }
} }
...@@ -63,8 +63,8 @@ char test_5(FILE *f) ...@@ -63,8 +63,8 @@ char test_5(FILE *f)
struct foo tmp; struct foo tmp;
if (1 == fread(&tmp, sizeof(tmp), 1, f)) { if (1 == fread(&tmp, sizeof(tmp), 1, f)) {
if (tmp.i < 256) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" } */ if (tmp.i < 256) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" "warning" } */
/* { dg-message "'tmp.i' has its upper bound checked here" "" { target *-*-* } .-1 } */ /* { dg-message "'tmp.i' has its upper bound checked here" "event" { target *-*-* } .-1 } */
return tmp.buf[tmp.i]; /* { dg-warning "use of tainted value 'tmp.i' in array lookup without lower-bounds checking" } */ return tmp.buf[tmp.i]; /* { dg-warning "use of tainted value 'tmp.i' in array lookup without lower-bounds checking" } */
} }
} }
......
...@@ -75,8 +75,8 @@ void test_4a (void) ...@@ -75,8 +75,8 @@ void test_4a (void)
node_a.next = &node_b; node_a.next = &node_b;
node_b.ptr = malloc (sizeof (int)); node_b.ptr = malloc (sizeof (int));
global_ptr = &node_a; global_ptr = &node_a;
*node_b.ptr = 42; /* { dg-warning "possibly-NULL" } */ *node_b.ptr = 42; /* { dg-warning "possibly-NULL" "possibly-NULL" } */
/* { dg-warning "leak" "" { target *-*-* } .-1 } */ /* { dg-warning "leak" "leak" { target *-*-* } .-1 } */
/* FIXME: the above leak report is correct, but is reported at the wrong /* FIXME: the above leak report is correct, but is reported at the wrong
location. */ location. */
} /* { dg-warning "leak" } */ } /* { dg-warning "leak" } */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment