aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/null-terminated-strings-2.c
blob: 3bbae821cd46183b70a3543b8a8002b02a64143d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "../../gcc.dg/analyzer/analyzer-decls.h"

char buf[16];

int main (void)
{
  /* We should be able to assume that "buf" is all zeroes here.  */

  __analyzer_eval (__analyzer_get_strlen (buf) == 0); /* { dg-warning "TRUE" "ideal" { xfail *-*-* } } */
  /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */

  buf[0] = 'a';
  __analyzer_eval (__analyzer_get_strlen (buf) == 1);  /* { dg-warning "TRUE" "ideal" { xfail *-*-* } } */
  /* { dg-bogus "UNKNOWN" "status quo" { xfail *-*-* } .-1 } */

  return 0;
}