Skip several analyzer socket tests on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / symbolic-2.c
blob70c00ce386751d930735eba35b13f8a6f1d9ff78
1 #include "analyzer-decls.h"
3 struct foo
5 int ival;
6 int iarr[10];
7 };
9 void test_1 (int i, int j)
11 struct foo fooarr[4];
12 fooarr[1].ival = 42;
13 fooarr[1].iarr[3] = 27;
14 fooarr[2].iarr[1] = 17;
15 __analyzer_eval (fooarr[1].ival == 42); /* { dg-warning "TRUE" } */
16 __analyzer_eval (fooarr[1].iarr[3] == 27); /* { dg-warning "TRUE" } */
17 __analyzer_eval (fooarr[2].iarr[1] == 17); /* { dg-warning "TRUE" } */
19 /* Symbolic binding. */
20 fooarr[2].iarr[i] = j;
21 __analyzer_eval (fooarr[2].iarr[i] == j); /* { dg-warning "TRUE" } */
23 /* We should have lost our knowledge about fooarr[2].
24 It's not clear to me if we should also lose our knowledge about
25 fooarr[1] (for the case where i is negative). For now, we do. */
26 __analyzer_eval (fooarr[1].ival == 42); /* { dg-warning "UNKNOWN" } */
27 __analyzer_eval (fooarr[1].iarr[3] == 27); /* { dg-warning "UNKNOWN" } */
28 __analyzer_eval (fooarr[2].iarr[1] == 17); /* { dg-warning "UNKNOWN" } */
29 /* Should also be safe to read from fooarr[2];
30 it isn't known to be uninit anymore. */
31 __analyzer_eval (fooarr[2].iarr[10] == 17); /* { dg-warning "UNKNOWN" } */