1 // RUN: %clang_analyze_cc1 -Wno-array-bounds -analyzer-checker=core,alpha.security.ArrayBound -analyzer-store=region -verify %s
2 // XFAIL: *
3
4 // Once we better handle modeling of sizes of VLAs, we can pull this back
5 // into outofbound.c.
6
sizeof_vla(int a)7 void sizeof_vla(int a) {
8 if (a == 5) {
9 char x[a];
10 int y[sizeof(x)];
11 y[4] = 4; // no-warning
12 y[5] = 5; // expected-warning{{out-of-bound}}
13 }
14 }
15
sizeof_vla_2(int a)16 void sizeof_vla_2(int a) {
17 if (a == 5) {
18 char x[a];
19 int y[sizeof(x) / sizeof(char)];
20 y[4] = 4; // no-warning
21 y[5] = 5; // expected-warning{{out-of-bound}}
22 }
23 }
24
sizeof_vla_3(int a)25 void sizeof_vla_3(int a) {
26 if (a == 5) {
27 char x[a];
28 int y[sizeof(*&*&*&x)];
29 y[4] = 4; // no-warning
30 y[5] = 5; // expected-warning{{out-of-bound}}
31 }
32 }
33