1 #include "analyzer-decls.h" 2 3 extern void maybe_write (int *); 4 test_1(int i)5void test_1 (int i) 6 { 7 /* An array with purely concrete bindings. */ 8 int arr[2]; 9 arr[0] = 1066; 10 arr[1] = 1776; 11 12 /* Concrete reads. */ 13 __analyzer_eval (arr[0] == 1066); /* { dg-warning "TRUE" } */ 14 __analyzer_eval (arr[1] == 1776); /* { dg-warning "TRUE" } */ 15 16 /* Symbolic read. */ 17 __analyzer_describe (0, arr[i]); /* { dg-warning "svalue: 'UNKNOWN\\(int\\)'" } */ 18 __analyzer_eval (arr[i] == 1776); /* { dg-warning "UNKNOWN" } */ 19 } 20 test_2(int i)21void test_2 (int i) 22 { 23 /* An array that could have been touched. */ 24 int arr[2]; 25 maybe_write (arr); 26 27 /* Concrete reads. */ 28 __analyzer_eval (arr[0] == 42); /* { dg-warning "UNKNOWN" } */ 29 30 /* Symbolic read. */ 31 __analyzer_eval (arr[i] == 42); /* { dg-warning "UNKNOWN" } */ 32 } 33 test_3(int i)34void test_3 (int i) 35 { 36 /* An array that can't have been touched. */ 37 int arr[2]; 38 39 /* Concrete reads. */ 40 __analyzer_eval (arr[0] == 42); /* { dg-warning "UNKNOWN" } */ 41 42 /* Symbolic read. */ 43 __analyzer_eval (arr[i] == 42); /* { dg-warning "UNKNOWN" } */ 44 } 45