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.
This commit is contained in:
parent
bec2387682
commit
8863f61c9c
34 changed files with 269 additions and 232 deletions
|
@ -1,3 +1,40 @@
|
|||
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>
|
||||
|
||||
* gcc.dg/torture/pr26515.c (cris*-*-*): Conditionalize
|
||||
|
|
|
@ -11,8 +11,8 @@ void
|
|||
recvauth_common(krb5_data inbuf)
|
||||
{
|
||||
free(inbuf.data);
|
||||
free(inbuf.data); /* { dg-warning "double-'free'" } */
|
||||
/* { dg-message "2 duplicates" "" { target *-*-* } .-1 } */
|
||||
free(inbuf.data); /* { dg-warning "double-'free'" "warning" } */
|
||||
/* { dg-message "2 duplicates" "duplicates notification" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void krb5_recvauth(krb5_data inbuf)
|
||||
|
|
|
@ -20,8 +20,8 @@ void test_1 (void *p, void *q, void *r)
|
|||
void test_1a (void *q, void *r)
|
||||
{
|
||||
void *p = NULL;
|
||||
foo(p, q, r); /* { dg-warning "use of NULL 'p' where non-null expected" } */
|
||||
/* { dg-message "argument 1 \\('p'\\) NULL where non-null expected" "" { target *-*-* } .-1 } */
|
||||
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" "note" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_2 (void *p, 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" } */
|
||||
|
||||
foo(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */
|
||||
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */
|
||||
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" "note" { target *-*-* } .-1 } */
|
||||
|
||||
foo(p, q, r);
|
||||
|
||||
|
@ -48,8 +48,8 @@ void test_4 (void *q, void *r)
|
|||
{
|
||||
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" } */
|
||||
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */
|
||||
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" "note" { target *-*-* } .-1 } */
|
||||
|
||||
bar(p, q, r);
|
||||
|
||||
|
@ -71,8 +71,8 @@ void test_5 (void *q, void *r)
|
|||
{
|
||||
void *p = malloc(1024); /* { dg-message "\\(1\\) this call could return NULL" } */
|
||||
bar_t cb = get_bar ();
|
||||
cb(p, q, r); /* { dg-warning "use of possibly-NULL 'p' where non-null expected" } */
|
||||
/* { dg-message "argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */
|
||||
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" "note" { target *-*-* } .-1 } */
|
||||
/* TODO: do we want an event showing where cb is assigned "bar"? */
|
||||
|
||||
cb(p, q, r);
|
||||
|
|
|
@ -7,15 +7,15 @@ void test (int i, int j)
|
|||
{
|
||||
__analyzer_eval (i > 4); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (i <= 4); /* { dg-warning "FALSE" } */
|
||||
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (i > 5); /* { dg-warning "UNKNOWN" } */
|
||||
__analyzer_eval (i != 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i != 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (i == 3); /* { dg-warning "FALSE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 3); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (i != 4); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "FALSE" } */
|
||||
|
@ -33,8 +33,8 @@ void test (int i, int j)
|
|||
else
|
||||
{
|
||||
__analyzer_eval (j >= i); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (j > 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (j > 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -43,21 +43,21 @@ void test (int i, int j)
|
|||
__analyzer_eval (i <= 4); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (i > 3); /* { dg-warning "UNKNOWN" } */
|
||||
|
||||
__analyzer_eval (i > 5); /* { dg-warning "FALSE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 5); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
__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 == 5); /* { dg-warning "FALSE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i != 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 5); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i != 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i < 5); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (i <= 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i <= 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,12 +68,12 @@ void test_2 (int i, int j, int k)
|
|||
__analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */
|
||||
if (j >= k)
|
||||
{
|
||||
__analyzer_eval (i >= k); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i >= k); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == k); /* { dg-warning "UNKNOWN" } */
|
||||
if (k >= i)
|
||||
__analyzer_eval (i == k); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == k); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ void test_range_int_gt_lt (int i)
|
|||
{
|
||||
if (i > 3)
|
||||
if (i < 5)
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_range_float_gt_lt (float f)
|
||||
|
@ -116,8 +116,8 @@ void test_range_int_ge_lt (int i)
|
|||
{
|
||||
if (i >= 4)
|
||||
if (i < 5)
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_range_float_ge_lt (float f)
|
||||
|
@ -131,8 +131,8 @@ void test_range_int_gt_le (int i)
|
|||
{
|
||||
if (i > 3)
|
||||
if (i <= 4)
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_range_float_gt_le (float f)
|
||||
|
@ -146,14 +146,14 @@ void test_range_int_ge_le (int i)
|
|||
{
|
||||
if (i >= 4)
|
||||
if (i <= 4)
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_range_float_ge_le (float f)
|
||||
{
|
||||
if (f >= 4)
|
||||
if (f <= 4)
|
||||
__analyzer_eval (f == 4); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (f == 4); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
}
|
||||
|
|
|
@ -178,13 +178,13 @@ int test_12d (struct coord c)
|
|||
{
|
||||
struct coord d;
|
||||
d = c;
|
||||
__analyzer_eval (d.x == c.x); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (d.x == c.x); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "actual" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): c and d share the same unknown value of type "coord", but
|
||||
attempts to access the fields lead to different unknown values. */
|
||||
|
||||
__analyzer_eval (d.y == c.y); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (d.y == c.y); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "actual" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): likewise
|
||||
|
||||
__analyzer_eval (d.x == d.y); /* { dg-warning "UNKNOWN" } */
|
||||
|
@ -222,8 +222,8 @@ void test_15 (const char *str)
|
|||
{
|
||||
char ch = str[0];
|
||||
__analyzer_eval (ch == 'a'); /* { dg-warning "UNKNOWN" } */
|
||||
__analyzer_eval (ch == str[0]); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (ch == str[0]); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
|
||||
ch = 'a';
|
||||
|
@ -237,12 +237,12 @@ void test_16 (void)
|
|||
|
||||
__analyzer_eval (msg != NULL); /* { dg-warning "TRUE" } */
|
||||
|
||||
__analyzer_eval (msg[0] == 'h'); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (msg[0] == 'h'); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
|
||||
__analyzer_eval (msg[1] == 'e'); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (msg[1] == 'e'); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
|
||||
__analyzer_eval (strlen (msg) == 11); /* { dg-warning "TRUE" } */
|
||||
|
@ -260,12 +260,12 @@ void test_16_alt (void)
|
|||
|
||||
__analyzer_eval (msg != NULL); /* { dg-warning "TRUE" } */
|
||||
|
||||
__analyzer_eval (msg[0] == 'h'); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (msg[0] == 'h'); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
|
||||
__analyzer_eval (msg[1] == 'e'); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (msg[1] == 'e'); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
|
||||
__analyzer_eval (strlen (msg) == 11); /* { dg-warning "TRUE" } */
|
||||
|
@ -278,8 +278,8 @@ void test_16a (const char *msg)
|
|||
|
||||
void test_16b (const char *msg)
|
||||
{
|
||||
__analyzer_eval (strlen (msg) == strlen (msg)); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (strlen (msg) == strlen (msg)); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
}
|
||||
|
||||
|
@ -472,8 +472,8 @@ void test_23 (struct foo *f, struct foo *g)
|
|||
i = f->i + g->i;
|
||||
j = f->i + g->i;
|
||||
k = f->i * g->i;
|
||||
__analyzer_eval (i == j); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i == j); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): we'd need to record that the two unknown values are both
|
||||
the sum of the two unknown input values (and thus are the same); not
|
||||
yet sure if we want arbitrary expression trees in the representation
|
||||
|
@ -491,8 +491,8 @@ void test_24 (struct foo *f)
|
|||
/* Overwriting a whole struct should invalidate our knowledge
|
||||
about fields within it. */
|
||||
g = *f;
|
||||
__analyzer_eval (g.i == 42); /* { dg-warning "UNKNOWN" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "TRUE" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (g.i == 42); /* { dg-warning "UNKNOWN" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "TRUE" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
}
|
||||
|
||||
|
@ -508,8 +508,8 @@ void test_25 (struct foo *f)
|
|||
source value should update our knowledge about fields within
|
||||
the dest value. */
|
||||
g = *f;
|
||||
__analyzer_eval (g.i == 43); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (g.i == 43); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail)
|
||||
}
|
||||
|
||||
|
@ -526,11 +526,11 @@ void test_26 (struct coord *p, struct coord *q)
|
|||
source value should update our knowledge about fields within
|
||||
the dest value. */
|
||||
*p = *q;
|
||||
__analyzer_eval (p->x); /* { dg-warning "UNKNOWN" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "TRUE" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p->x); /* { dg-warning "UNKNOWN" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "TRUE" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): should have been overwritten
|
||||
__analyzer_eval (p->y == 17); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p->y == 17); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): should have been overwritten with q->y
|
||||
|
||||
__analyzer_eval (q->x); /* { dg-warning "UNKNOWN" } */
|
||||
|
@ -540,29 +540,29 @@ void test_26 (struct coord *p, struct coord *q)
|
|||
void test_27 (struct coord *p)
|
||||
{
|
||||
memset (p, 0, sizeof (struct coord));
|
||||
__analyzer_eval (p->x == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p->x == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
__analyzer_eval (p->y == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p->y == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
}
|
||||
|
||||
void test_28 (struct coord *p)
|
||||
{
|
||||
memset (p, 0, sizeof (struct coord) * 10);
|
||||
__analyzer_eval (p[0].x == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p[0].x == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
__analyzer_eval (p[0].y == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p[0].y == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
|
||||
__analyzer_eval (p[9].x == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p[9].x == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
__analyzer_eval (p[9].y == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (p[9].y == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail):
|
||||
|
||||
__analyzer_eval (p[10].x == 0); /* { dg-warning "UNKNOWN" } */
|
||||
|
@ -970,13 +970,13 @@ void test_44 (void)
|
|||
{
|
||||
struct sbits bits;
|
||||
bits.b0 = 1;
|
||||
__analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): ^^^^
|
||||
|
||||
bits.b456 = 5;
|
||||
__analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "FALSE" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): ^^^^
|
||||
};
|
||||
|
||||
|
@ -994,13 +994,13 @@ void test_45 (void)
|
|||
{
|
||||
struct ubits bits;
|
||||
bits.b0 = 1;
|
||||
__analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (bits.b0 == 1); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): ^^^^
|
||||
|
||||
bits.b456 = 5;
|
||||
__analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (bits.b456 == 5); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
// TODO(xfail): ^^^^
|
||||
};
|
||||
|
||||
|
@ -1058,10 +1058,10 @@ void test_51 (struct coord c)
|
|||
{
|
||||
struct coord d;
|
||||
memcpy (&d, &c, sizeof (struct coord));
|
||||
__analyzer_eval (c.x == d.x); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (c.y == d.y); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (c.x == d.x); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (c.y == d.y); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
struct big
|
||||
|
@ -1073,8 +1073,8 @@ void test_52 (struct big b)
|
|||
{
|
||||
struct big d;
|
||||
memcpy (&d, &b, sizeof (struct big));
|
||||
__analyzer_eval (b.ia[0] == d.ia[0]); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (b.ia[0] == d.ia[0]); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void test_53 (const char *msg)
|
||||
|
|
|
@ -16,7 +16,7 @@ void test (int *p, int i, int j)
|
|||
|
||||
__analyzer_eval (p[3] == 42); /* { dg-warning "UNKNOWN" } */
|
||||
__analyzer_eval (p[i] == 17); /* { dg-warning "TRUE" } */
|
||||
__analyzer_eval (p[j] == 17); /* { dg-warning "UNKNOWN" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "TRUE" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (p[j] == 17); /* { dg-warning "UNKNOWN" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "TRUE" "status quo" { xfail *-*-* } .-1 } */
|
||||
// FIXME(xfails) ^^^
|
||||
}
|
||||
|
|
|
@ -21,6 +21,6 @@ void test (void)
|
|||
|
||||
struct base *bp = (struct base *)&s;
|
||||
|
||||
__analyzer_eval (bp->i == 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (bp->i == 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
|
|
@ -14,8 +14,8 @@ void test_1 (void)
|
|||
struct foo *f = calloc (1, sizeof (struct foo));
|
||||
if (f == NULL)
|
||||
return;
|
||||
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
free (f);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ void test_2 (void)
|
|||
if (f == NULL)
|
||||
return;
|
||||
memset (f, 0, sizeof (struct foo));
|
||||
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-1 } */
|
||||
__analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */
|
||||
free (f);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,10 @@ test_1 (const char *path)
|
|||
if (!f)
|
||||
return;
|
||||
|
||||
fclose (f); /* { dg-message "\\(4\\) \\.\\.\\.to here" } */
|
||||
/* { dg-message "\\(5\\) first 'fclose' here" "" { target *-*-* } .-1 } */
|
||||
fclose (f); /* { dg-warning "double 'fclose' of FILE 'f'" } */
|
||||
/* { dg-message "second 'fclose' here; first 'fclose' was at \\(5\\)" "" { target *-*-* } .-1 } */
|
||||
fclose (f); /* { dg-message "\\(4\\) \\.\\.\\.to here" "to here" } */
|
||||
/* { dg-message "\\(5\\) first 'fclose' here" "first fclose" { target *-*-* } .-1 } */
|
||||
fclose (f); /* { dg-warning "double 'fclose' of FILE 'f'" "warning" } */
|
||||
/* { dg-message "second 'fclose' here; first 'fclose' was at \\(5\\)" "second fclose" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -22,8 +22,8 @@ test_2 (const char *src, const char *dst)
|
|||
|
||||
FILE *f_out = fopen (src, "w");
|
||||
if (!f_out)
|
||||
return; /* { dg-warning "leak of FILE 'f_in'" } */
|
||||
/* { dg-message "\\(7\\) 'f_in' leaks here; was opened at \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
return; /* { dg-warning "leak of FILE 'f_in'" "warning" } */
|
||||
/* { dg-message "\\(7\\) 'f_in' leaks here; was opened at \\(1\\)" "event" { target *-*-* } .-1 } */
|
||||
|
||||
fclose (f_out);
|
||||
fclose (f_in);
|
||||
|
|
|
@ -11,8 +11,8 @@ void f1 (const char *str)
|
|||
while (fgets(buf, 10, fp) != NULL) /* { dg-message "following 'false' branch\\.\\.\\." } */
|
||||
{
|
||||
}
|
||||
} /* { dg-warning "leak of FILE 'fp'" } */
|
||||
/* { dg-message "\\.\\.\\.to here" "" { target *-*-* } .-1 } */
|
||||
} /* { dg-warning "leak of FILE 'fp'" "warning" } */
|
||||
/* { dg-message "\\.\\.\\.to here" "to here" { target *-*-* } .-1 } */
|
||||
|
||||
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'" } */
|
||||
fclose(fp);
|
||||
} /* { dg-warning "leak of FILE 'fp'" } */
|
||||
/* { dg-message "\\.\\.\\.to here" "" { target *-*-* } .-1 } */
|
||||
} /* { dg-warning "leak of FILE 'fp'" "warning" } */
|
||||
/* { dg-message "\\.\\.\\.to here" "to here" { target *-*-* } .-1 } */
|
||||
|
|
|
@ -29,8 +29,8 @@ void test(void)
|
|||
|
||||
__analyzer_eval (s.i >= 256); /* { dg-warning "TRUE" } */
|
||||
|
||||
__analyzer_eval (s.i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (s.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */
|
||||
|
||||
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
|
||||
|
|
|
@ -14,9 +14,9 @@ void test(void)
|
|||
|
||||
|
||||
for (u.i=0; u.i<256; u.i++) {
|
||||
__analyzer_eval (u.i < 256); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "TRUE" "" { xfail *-*-* } .-1 } */
|
||||
/* { dg-bogus "UNKNOWN" "" { xfail *-*-* } .-2 } */
|
||||
__analyzer_eval (u.i < 256); /* { dg-warning "TRUE" "1st" } */
|
||||
/* { dg-warning "TRUE" "2nd" { xfail *-*-* } .-1 } */
|
||||
/* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-2 } */
|
||||
/* (should report TRUE twice). */
|
||||
|
||||
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */
|
||||
|
@ -29,11 +29,11 @@ void test(void)
|
|||
//__analyzer_eval (u.i >= 0); /* { d-todo-g-warning "TRUE" } */
|
||||
}
|
||||
|
||||
__analyzer_eval (u.i >= 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (u.i >= 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (u.i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (u.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */
|
||||
|
||||
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
|
||||
|
|
|
@ -13,15 +13,15 @@ void test(void)
|
|||
|
||||
for (i=0; i<256; i++) {
|
||||
|
||||
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" "true" } */
|
||||
/* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (i < 256); /* { dg-warning "TRUE" } */
|
||||
|
||||
for (j=0; j<256; j++) {
|
||||
|
||||
__analyzer_eval (j >= 0); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (j >= 0); /* { dg-warning "TRUE" "true" } */
|
||||
/* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (j < 256); /* { dg-warning "TRUE" } */
|
||||
|
||||
|
@ -29,8 +29,8 @@ void test(void)
|
|||
|
||||
for (k=0; k<256; k++) {
|
||||
|
||||
__analyzer_eval (k >= 0); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (k >= 0); /* { dg-warning "TRUE" "true" } */
|
||||
/* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
|
||||
|
||||
__analyzer_eval (k < 256); /* { dg-warning "TRUE" } */
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ void test(void)
|
|||
__analyzer_eval (i < 256); /* { dg-warning "TRUE" } */
|
||||
/* (should report TRUE twice). */
|
||||
|
||||
__analyzer_eval (i == 0); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "FALSE" "" { xfail *-*-* } .-1 } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-2 } */
|
||||
__analyzer_eval (i == 0); /* { dg-warning "TRUE" "1st" } */
|
||||
/* { dg-warning "FALSE" "2nd" { xfail *-*-* } .-1 } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */
|
||||
/* TODO(xfail^^^): ideally we ought to figure out i > 0 after 1st iteration. */
|
||||
|
||||
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" } */
|
||||
/* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-2 } */
|
||||
__analyzer_eval (i >= 0); /* { dg-warning "TRUE" "1st" } */
|
||||
/* { dg-warning "TRUE" "2nd" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */
|
||||
/* TODO(xfail^^^): ideally we ought to figure out i >= 0 for all iterations. */
|
||||
|
||||
__analyzer_dump_exploded_nodes (0); /* { dg-warning "2 exploded nodes" } */
|
||||
|
@ -27,8 +27,8 @@ void test(void)
|
|||
|
||||
__analyzer_eval (i >= 256); /* { dg-warning "TRUE" } */
|
||||
|
||||
__analyzer_eval (i == 256); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail^^^): it only figures out i >= 256, rather than i == 256. */
|
||||
|
||||
__analyzer_dump_exploded_nodes (0); /* { dg-warning "1 exploded node" } */
|
||||
|
|
|
@ -474,8 +474,8 @@ test_41 (int flag)
|
|||
buffer = NULL;
|
||||
}
|
||||
|
||||
buffer[0] = 'a'; /* { dg-warning "dereference of possibly-NULL 'buffer'" } */
|
||||
/* { dg-warning "dereference of NULL 'buffer'" "" { target *-*-* } .-1 } */
|
||||
buffer[0] = 'a'; /* { dg-warning "dereference of possibly-NULL 'buffer'" "possibly-NULL" } */
|
||||
/* { dg-warning "dereference of NULL 'buffer'" "NULL" { target *-*-* } .-1 } */
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ extern char *strcpy(char *__restrict __dest, const char *__restrict __src)
|
|||
void test_1 (void)
|
||||
{
|
||||
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" } */
|
||||
/* { dg-message "\\(2\\) argument 1 \\('p'\\) from \\(1\\) could be NULL where non-null expected" "" { target *-*-* } .-1 } */
|
||||
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" "event" { target *-*-* } .-1 } */
|
||||
free (p);
|
||||
}
|
||||
|
||||
int *test_2 (void)
|
||||
{
|
||||
int *i = malloc (sizeof (int)); /* { dg-message "\\(1\\) this call could return NULL" } */
|
||||
*i = 42; /* { dg-warning "dereference of possibly-NULL 'i'" } */
|
||||
/* { dg-message "\\(2\\) 'i' could be NULL: unchecked value from \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
*i = 42; /* { dg-warning "dereference of possibly-NULL 'i'" "warning" } */
|
||||
/* { dg-message "\\(2\\) 'i' could be NULL: unchecked value from \\(1\\)" "event" { target *-*-* } .-1 } */
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" } */
|
||||
/* { dg-message "\\(7\\) entry to 'calls_free'" "" { target *-*-* } .-1 } */
|
||||
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" "event 3" } */
|
||||
/* { dg-message "\\(7\\) entry to 'calls_free'" "event 7" { target *-*-* } .-1 } */
|
||||
{
|
||||
free (victim); /* { dg-warning "double-'free' of 'victim'" } */
|
||||
/* { dg-message "\\(4\\) first 'free' here" "" { target *-*-* } .-1 } */
|
||||
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "" { target *-*-* } .-2 } */
|
||||
free (victim); /* { dg-warning "double-'free' of 'victim'" "warning" } */
|
||||
/* { dg-message "\\(4\\) first 'free' here" "event 4" { target *-*-* } .-1 } */
|
||||
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "event 8" { target *-*-* } .-2 } */
|
||||
|
||||
/* TODO: would this be better emitted at the callsite,
|
||||
for such a simple wrapper? */
|
||||
|
@ -21,8 +21,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */
|
|||
{
|
||||
do_stuff ();
|
||||
|
||||
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" } */
|
||||
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "" { target *-*-* } .-1 } */
|
||||
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" "event 2" } */
|
||||
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "event 5" { target *-*-* } .-1 } */
|
||||
|
||||
do_stuff ();
|
||||
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" } */
|
||||
/* { dg-message "\\(7\\) entry to 'calls_free'" "" { target *-*-* } .-1 } */
|
||||
calls_free (void *victim) /* { dg-message "\\(3\\) entry to 'calls_free'" "event 3" } */
|
||||
/* { dg-message "\\(7\\) entry to 'calls_free'" "event 7" { target *-*-* } .-1 } */
|
||||
{
|
||||
free (victim); /* { dg-warning "double-'free' of 'victim'" } */
|
||||
/* { dg-message "\\(4\\) first 'free' here" "" { target *-*-* } .-1 } */
|
||||
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "" { target *-*-* } .-2 } */
|
||||
free (victim); /* { dg-warning "double-'free' of 'victim'" "warning" } */
|
||||
/* { dg-message "\\(4\\) first 'free' here" "event 4" { target *-*-* } .-1 } */
|
||||
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(4\\)" "event 8" { target *-*-* } .-2 } */
|
||||
|
||||
/* TODO: would this be better emitted at the callsite,
|
||||
for such a simple wrapper? */
|
||||
|
@ -20,8 +20,8 @@ void test (void *ptr) /* { dg-message "\\(1\\) entry to 'test'" } */
|
|||
{
|
||||
do_stuff ();
|
||||
|
||||
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" } */
|
||||
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "" { target *-*-* } .-1 } */
|
||||
calls_free (ptr); /* { dg-message "\\(2\\) calling 'calls_free' from 'test'" "event 2" } */
|
||||
/* { dg-message "\\(5\\) returning to 'test' from 'calls_free'" "event 5" { target *-*-* } .-1 } */
|
||||
|
||||
do_stuff ();
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
#include "malloc-macro.h"
|
||||
|
||||
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } 2 } */
|
||||
/* { dg-message "first 'free' here" "" { target *-*-* } 2 } */
|
||||
/* { dg-message "second 'free' here" "" { target *-*-* } 2 } */
|
||||
/* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } 2 } */
|
||||
/* { dg-message "first 'free' here" "1st free event" { target *-*-* } 2 } */
|
||||
/* { dg-message "second 'free' here" "2nd free event" { target *-*-* } 2 } */
|
||||
|
||||
int test (void *ptr)
|
||||
{
|
||||
|
|
|
@ -8,8 +8,8 @@ void test_1 (void)
|
|||
free (ptr); /* { dg-line first_free } */
|
||||
free (ptr); /* { dg-line second_free } */
|
||||
|
||||
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } second_free } */
|
||||
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) first 'free' here" "" { target *-*-* } first_free } */
|
||||
/* { dg-message "\\(3\\) second 'free' here; first 'free' was at \\(2\\)" "" { target *-*-* } second_free } */
|
||||
/* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } second_free } */
|
||||
/* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) first 'free' here" "event 2" { target *-*-* } first_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)
|
|||
free (ptr); /* { dg-line first_free } */
|
||||
free (ptr); /* { dg-line second_free } */
|
||||
|
||||
/* { dg-warning "double-'free' of 'ptr'" "" { target *-*-* } second_free } */
|
||||
/* { dg-message "\\(1\\) first 'free' here" "" { target *-*-* } first_free } */
|
||||
/* { dg-message "\\(2\\) second 'free' here; first 'free' was at \\(1\\)" "" { target *-*-* } second_free } */
|
||||
/* { dg-warning "double-'free' of 'ptr'" "warning" { target *-*-* } second_free } */
|
||||
/* { dg-message "\\(1\\) first 'free' here" "event 1" { target *-*-* } first_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)
|
|||
*ptr = 42; /* { dg-line unchecked_deref } */
|
||||
return ptr;
|
||||
|
||||
/* { dg-warning "dereference of possibly-NULL 'ptr'" "" { target *-*-* } unchecked_deref } */
|
||||
/* { dg-message "\\(1\\) this call could return NULL" "" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) 'ptr' could be NULL" "" { target *-*-* } unchecked_deref } */
|
||||
/* { dg-warning "dereference of possibly-NULL 'ptr'" "warning" { target *-*-* } unchecked_deref } */
|
||||
/* { dg-message "\\(1\\) this call could return NULL" "event 1" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) 'ptr' could be NULL" "event 2" { target *-*-* } unchecked_deref } */
|
||||
}
|
||||
|
|
|
@ -11,10 +11,10 @@ int *test_4 (void)
|
|||
*ptr = 43; /* { dg-line on_null_ptr } */
|
||||
return ptr;
|
||||
|
||||
/* { dg-warning "dereference of NULL 'ptr'" "" { target *-*-* } on_null_ptr } */
|
||||
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) assuming 'ptr' is NULL" "" { target *-*-* } cond } */
|
||||
/* { dg-message "\\(3\\) following 'false' branch \\(when 'ptr' is NULL\\)\\.\\.\\." "" { target *-*-* } cond } */
|
||||
/* { dg-message "\\(4\\) \\.\\.\\.to here" "" { target *-*-* } on_null_ptr } */
|
||||
/* { dg-message "\\(5\\) dereference of NULL 'ptr'" "" { target *-*-* } on_null_ptr } */
|
||||
/* { dg-warning "dereference of NULL 'ptr'" "warning" { target *-*-* } on_null_ptr } */
|
||||
/* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc } */
|
||||
/* { dg-message "\\(2\\) assuming 'ptr' is NULL" "event 2" { target *-*-* } cond } */
|
||||
/* { dg-message "\\(3\\) following 'false' branch \\(when 'ptr' is NULL\\)\\.\\.\\." "event 3" { target *-*-* } cond } */
|
||||
/* { dg-message "\\(4\\) \\.\\.\\.to here" "event 4" { 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)
|
|||
free (q);
|
||||
return 0;
|
||||
|
||||
/* { dg-warning "double-'free' of 'p'" "" { target *-*-* } second_free_of_p } */
|
||||
/* { dg-message "\\(1\\) allocated here" "" { target *-*-* } malloc_of_p } */
|
||||
/* { dg-message "\\(2\\) assuming 'p' is non-NULL" "" { target *-*-* } test_of_p } */
|
||||
/* { dg-message "\\(3\\) following 'false' branch \\(when 'p' is non-NULL\\)\\.\\.\\." "" { target *-*-* } test_of_p } */
|
||||
/* { dg-message "\\(4\\) \\.\\.\\.to here" "" { target *-*-* } malloc_of_q } */
|
||||
/* { dg-message "\\(5\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." "" { target *-*-* } test_of_q } */
|
||||
/* { dg-message "\\(6\\) \\.\\.\\.to here" "" { target *-*-* } first_free_of_p } */
|
||||
/* { dg-message "\\(7\\) first 'free' here" "" { target *-*-* } first_free_of_p } */
|
||||
/* { dg-message "\\(8\\) second 'free' here; first 'free' was at \\(7\\)" "" { target *-*-* } second_free_of_p } */
|
||||
/* { dg-warning "double-'free' of 'p'" "warning" { target *-*-* } second_free_of_p } */
|
||||
/* { dg-message "\\(1\\) allocated here" "event 1" { target *-*-* } malloc_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\\)\\.\\.\\." "event 3" { target *-*-* } test_of_p } */
|
||||
/* { dg-message "\\(4\\) \\.\\.\\.to here" "event 4" { target *-*-* } malloc_of_q } */
|
||||
/* { dg-message "\\(5\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." "event 5" { target *-*-* } test_of_q } */
|
||||
/* { dg-message "\\(6\\) \\.\\.\\.to here" "event 6" { 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\\)" "event 8" { target *-*-* } second_free_of_p } */
|
||||
|
||||
/* We don't care about the state changes to q. */
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ void test (void)
|
|||
if (!q) /* { dg-message "\\(2\\) following 'true' branch \\(when 'q' is NULL\\)\\.\\.\\." } */
|
||||
{
|
||||
free (q); /* { dg-message "\\(3\\) \\.\\.\\.to here" } */
|
||||
return; /* { dg-warning "leak of 'p'" } */
|
||||
/* { dg-message "\\(4\\) 'p' leaks here; was allocated at \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
return; /* { dg-warning "leak of 'p'" "warning" } */
|
||||
/* { dg-message "\\(4\\) 'p' leaks here; was allocated at \\(1\\)" "event" { target *-*-* } .-1 } */
|
||||
}
|
||||
bar ();
|
||||
free (q);
|
||||
|
|
|
@ -111,9 +111,9 @@ int test_3 (int x, int y)
|
|||
if (y)
|
||||
free (ptr); /* No double-'free' warning: we've already attempted
|
||||
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
|
||||
/* { dg-warning "leak of 'ptr'" "" { target *-*-* } .-2 } */
|
||||
/* { dg-warning "leak of 'ptr'" "leak" { target *-*-* } .-2 } */
|
||||
}
|
||||
|
||||
/* "dereference of possibly-NULL 'ptr'". */
|
||||
|
|
|
@ -9,26 +9,26 @@ void test (int i, int j)
|
|||
|
||||
i += 3;
|
||||
|
||||
__analyzer_eval (i > 45); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 45); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): do we really know this? what about overflow? */
|
||||
|
||||
i -= 1;
|
||||
|
||||
__analyzer_eval (i > 44); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 44); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): do we really know this? what about overflow? */
|
||||
|
||||
i = 3 * i;
|
||||
|
||||
__analyzer_eval (i > 132); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 132); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): do we really know this? what about overflow? */
|
||||
|
||||
i /= 2;
|
||||
|
||||
__analyzer_eval (i > 66); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 66); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* 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: */
|
||||
|
@ -37,8 +37,8 @@ void test (int i, int j)
|
|||
|
||||
/* However, we should now know that m > 67: */
|
||||
m = i + 1;
|
||||
__analyzer_eval (m > 67); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (m > 67); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): do we really know this? what about overflow? */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ static int called_function(int j)
|
|||
|
||||
k = j - 1;
|
||||
|
||||
__analyzer_eval (k > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (k > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): we're not then updating based on the assignment. */
|
||||
|
||||
return k;
|
||||
|
@ -25,8 +25,8 @@ void test(int i)
|
|||
|
||||
i = called_function(i);
|
||||
|
||||
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail): we're not updating from the returned value. */
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ extern void bar(void *);
|
|||
|
||||
void test1(void *ptr)
|
||||
{
|
||||
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" } */
|
||||
/* { dg-warning "pattern match on 'ptr == 0'" "" { target *-*-* } .-1 } */
|
||||
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" "ptr != 0" } */
|
||||
/* { dg-warning "pattern match on 'ptr == 0'" "ptr == 0" { target *-*-* } .-1 } */
|
||||
foo(ptr);
|
||||
} else {
|
||||
bar(ptr);
|
||||
|
@ -21,8 +21,8 @@ void test_2 (void *p, void *q)
|
|||
return;
|
||||
foo(p);
|
||||
|
||||
/* { dg-warning "pattern match on 'p == 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q == 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'p != 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q != 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'p == 0'" "p == 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q == 0'" "q == 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ extern void bar(void *);
|
|||
|
||||
void test1(void *ptr)
|
||||
{
|
||||
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" } */
|
||||
/* { dg-warning "pattern match on 'ptr == 0'" "" { target *-*-* } .-1 } */
|
||||
if (ptr) { /* { dg-warning "pattern match on 'ptr != 0'" "ptr != 0" } */
|
||||
/* { dg-warning "pattern match on 'ptr == 0'" "ptr == 0" { target *-*-* } .-1 } */
|
||||
foo(ptr);
|
||||
} else {
|
||||
bar(ptr);
|
||||
|
@ -22,8 +22,8 @@ void test_2 (void *p, void *q)
|
|||
return;
|
||||
foo(p);
|
||||
|
||||
/* { dg-warning "pattern match on '<unknown> == 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on '<unknown> != 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'p != 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q != 0'" "" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on '<unknown> == 0'" "<unknown> == 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on '<unknown> != 0'" "<unknown> != 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
|
||||
/* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
|
||||
}
|
||||
|
|
|
@ -5,29 +5,29 @@
|
|||
char test_1 (FILE *logfile)
|
||||
{
|
||||
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\\\]" } */
|
||||
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
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\\)" "event" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
char test_2 (FILE *logfile, int i)
|
||||
{
|
||||
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\\\]" } */
|
||||
/* { 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 *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\\\]" } */
|
||||
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
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\\)" "event" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
char test_4 (FILE *logfile)
|
||||
{
|
||||
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\\\]" } */
|
||||
/* { dg-message "\\(2\\) sensitive value 'password' written to output file; acquired at \\(1\\)" "" { target *-*-* } .-1 } */
|
||||
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\\)" "event" { target *-*-* } .-1 } */
|
||||
}
|
||||
|
||||
static void called_by_test_5 (const char *value)
|
||||
|
|
|
@ -19,8 +19,8 @@ void test (int i)
|
|||
__analyzer_eval (i == 0); /* { dg-warning "FALSE" } */
|
||||
__analyzer_eval (i == 2); /* { dg-warning "UNKNOWN" } */
|
||||
__analyzer_eval (i == 3); /* { dg-warning "FALSE" } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "FALSE" "" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "" { target *-*-* } .-1 } */
|
||||
__analyzer_eval (i == 4); /* { dg-warning "FALSE" "desired" { xfail *-*-* } } */
|
||||
/* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
|
||||
/* TODO(xfail^^^): we're only checking against endpoints of case
|
||||
ranges, not the insides. */
|
||||
__analyzer_eval (i == 5); /* { dg-warning "FALSE" } */
|
||||
|
|
|
@ -12,14 +12,14 @@ char test_1(FILE *f)
|
|||
{
|
||||
struct foo tmp;
|
||||
|
||||
if (1 == fread(&tmp, sizeof(tmp), 1, f)) { /* { dg-message "\\(1\\) 'tmp' gets an unchecked value here" } */
|
||||
/* { dg-message "\\(2\\) following 'true' branch\\.\\.\\." "" { target *-*-* } .-1 } */
|
||||
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\\.\\.\\." "event 2" { target *-*-* } .-1 } */
|
||||
/* 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 */
|
||||
return tmp.buf[tmp.i]; // { dg-warning "use of tainted value 'tmp.i' in array lookup without bounds checking" } */
|
||||
/* { dg-message "23: \\(3\\) \\.\\.\\.to here" "" { target *-*-* } .-1 } */
|
||||
/* { dg-message "23: \\(4\\) 'tmp.i' has an unchecked value here \\(from 'tmp'\\)" "" { target *-*-* } .-2 } */
|
||||
/* { dg-message "\\(5\\) use of tainted value 'tmp.i' in array lookup without bounds checking" "" { target *-*-* } .-3 } */
|
||||
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" "event 3" { target *-*-* } .-1 } */
|
||||
/* { 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" "event 5" { target *-*-* } .-3 } */
|
||||
|
||||
// TOOD: better messages for state changes
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ char test_4(FILE *f)
|
|||
struct foo tmp;
|
||||
|
||||
if (1 == fread(&tmp, sizeof(tmp), 1, f)) {
|
||||
if (tmp.i >= 0) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" } */
|
||||
/* { dg-message "'tmp.i' has its lower bound checked here" "" { target *-*-* } .-1 } */
|
||||
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" "event" { target *-*-* } .-1 } */
|
||||
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)
|
|||
struct foo tmp;
|
||||
|
||||
if (1 == fread(&tmp, sizeof(tmp), 1, f)) {
|
||||
if (tmp.i < 256) { /* { dg-message "'tmp.i' has an unchecked value here \\(from 'tmp'\\)" } */
|
||||
/* { dg-message "'tmp.i' has its upper bound checked here" "" { target *-*-* } .-1 } */
|
||||
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" "event" { target *-*-* } .-1 } */
|
||||
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)
|
|||
node_a.next = &node_b;
|
||||
node_b.ptr = malloc (sizeof (int));
|
||||
global_ptr = &node_a;
|
||||
*node_b.ptr = 42; /* { dg-warning "possibly-NULL" } */
|
||||
/* { dg-warning "leak" "" { target *-*-* } .-1 } */
|
||||
*node_b.ptr = 42; /* { dg-warning "possibly-NULL" "possibly-NULL" } */
|
||||
/* { dg-warning "leak" "leak" { target *-*-* } .-1 } */
|
||||
/* FIXME: the above leak report is correct, but is reported at the wrong
|
||||
location. */
|
||||
} /* { dg-warning "leak" } */
|
||||
|
|
Loading…
Add table
Reference in a new issue