+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
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)
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)
{
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);
{
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);
{
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);
{
__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" } */
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
__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 } */
}
}
__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 } */
}
}
}
{
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)
{
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)
{
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)
{
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 } */
}
{
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" } */
{
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';
__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" } */
__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" } */
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)
}
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
/* 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)
}
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)
}
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" } */
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" } */
{
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): ^^^^
};
{
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): ^^^^
};
{
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
{
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)
__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) ^^^
}
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 } */
}
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);
}
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);
}
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
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);
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)
{
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 } */
__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" } */
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" } */
//__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" } */
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" } */
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" } */
__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" } */
__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" } */
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;
}
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;
}
#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? */
{
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 ();
#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? */
{
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 ();
#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)
{
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 } */
}
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 } */
}
*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 } */
}
*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 } */
}
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. */
}
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);
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'". */
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: */
/* 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? */
}
}
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;
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. */
}
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);
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 } */
}
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);
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 } */
}
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)
__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" } */
{
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
}
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" } */
}
}
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" } */
}
}
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" } */