1 // RUN: %clang_cc1 -triple i386-apple-darwin10 -analyze -analyzer-checker=core.builtin,debug.ExprInspection -verify %s 2 3 void clang_analyzer_eval(int); 4 initbug()5void initbug() { 6 const union { float a; } u = {}; 7 (void)u.a; // no-crash 8 } 9 10 int const parr[2] = {1}; constarr()11void constarr() { 12 int i = 2; 13 clang_analyzer_eval(parr[i]); // expected-warning{{UNDEFINED}} 14 i = 1; 15 clang_analyzer_eval(parr[i] == 0); // expected-warning{{TRUE}} 16 i = -1; 17 clang_analyzer_eval(parr[i]); // expected-warning{{UNDEFINED}} 18 } 19 20 struct SM { 21 int a; 22 int b; 23 }; 24 const struct SM sm = {.a = 1}; multinit()25void multinit() { 26 clang_analyzer_eval(sm.a == 1); // expected-warning{{TRUE}} 27 clang_analyzer_eval(sm.b == 0); // expected-warning{{TRUE}} 28 } 29