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
,
10 char arr
[1024]; /* { dg-message "region created on stack here" } */
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. */
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. */
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. */
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. */
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