1 // RUN: %clang_cc1 -triple=i386-apple-darwin10 -verify %s -analyze \
2 // RUN:   -analyzer-checker=debug.ExprInspection
3 
4 #define NULL 0
5 void clang_analyzer_eval(int);
6 
7 // pr28449: Used to crash.
foo(void)8 void foo(void) {
9   static const unsigned short array[] = (const unsigned short[]){0x0F00};
10   clang_analyzer_eval(array[0] == 0x0F00); // expected-warning{{TRUE}}
11 }
12 
13 // check that we propagate info through compound literal regions
bar()14 void bar() {
15   int *integers = (int[]){1, 2, 3};
16   clang_analyzer_eval(integers[0] == 1); // expected-warning{{TRUE}}
17   clang_analyzer_eval(integers[1] == 2); // expected-warning{{TRUE}}
18   clang_analyzer_eval(integers[2] == 3); // expected-warning{{TRUE}}
19 
20   int **pointers = (int *[]){&integers[0], NULL};
21   clang_analyzer_eval(pointers[0] == NULL); // expected-warning{{FALSE}}
22   clang_analyzer_eval(pointers[1] == NULL); // expected-warning{{TRUE}}
23 }
24