testsuite: Skip analyzer tests on AIX.
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / symbolic-1.c
blob0d78242381a6be39f4b4a061dd711ad4a7da022f
1 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
3 #include "analyzer-decls.h"
5 /* The example from store.h */
7 void test_1 (char a, char b, char c, char d, char e, char f,
8 int i, int j)
10 char arr[1024]; /* { dg-message "region created on stack here" } */
11 arr[2] = a; /* (1) */
12 arr[3] = b; /* (2) */
14 __analyzer_eval (arr[2] == a); /* { dg-warning "TRUE" } */
15 __analyzer_eval (arr[3] == b); /* { dg-warning "TRUE" } */
16 __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" "unknown" } */
17 /* { dg-warning "use of uninitialized value 'arr\\\[4\\\]'" "uninit" { target *-*-* } .-1 } */
19 /* Replace one concrete binding's value with a different value. */
20 arr[3] = c; /* (3) */
21 __analyzer_eval (arr[2] == a); /* { dg-warning "TRUE" } */
22 __analyzer_eval (arr[3] == c); /* { dg-warning "TRUE" } */
23 __analyzer_eval (arr[3] == b); /* { dg-warning "UNKNOWN" } */
24 __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" "unknown" } */
25 /* { dg-warning "use of uninitialized value 'arr\\\[4\\\]'" "uninit" { target *-*-* } .-1 } */
27 /* Symbolic binding. */
28 arr[i] = d; /* (4) */
29 __analyzer_eval (arr[i] == d); /* { dg-warning "TRUE" } */
30 __analyzer_eval (arr[2] == a); /* { dg-warning "UNKNOWN" } */
31 __analyzer_eval (arr[3] == c); /* { dg-warning "UNKNOWN" } */
32 __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" } */ /* Don't report uninit. */
34 /* Replace symbolic binding with a different one. */
35 arr[j] = e; /* (5) */
36 __analyzer_eval (arr[j] == e); /* { dg-warning "TRUE" } */
37 __analyzer_eval (arr[i] == d); /* { dg-warning "UNKNOWN" } */
38 __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" } */ /* Don't report uninit. */
40 /* Add a concrete binding. */
41 arr[3] = f; /* (6) */
42 __analyzer_eval (arr[3] == f); /* { dg-warning "TRUE" } */
43 __analyzer_eval (arr[j] == e); /* { dg-warning "UNKNOWN" } */
44 __analyzer_eval (arr[4]); /* { dg-warning "UNKNOWN" } */ /* Don't report uninit. */
47 // TODO: as above, but with int rather than char so there's a cast