region-store.c revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
1// RUN: %clang_cc1 -analyze -analyzer-checker=core,unix -verify %s
2// expected-no-diagnostics
3
4int printf(const char *restrict,...);
5
6// Testing core functionality of the region store.
7// radar://10127782
8int compoundLiteralTest() {
9    int index = 0;
10    for (index = 0; index < 2; index++) {
11        int thing = (int []){0, 1}[index];
12        printf("thing: %i\n", thing);
13    }
14    return 0;
15}
16
17int compoundLiteralTest2() {
18    int index = 0;
19    for (index = 0; index < 3; index++) {
20        int thing = (int [][3]){{0,0,0}, {1,1,1}, {2,2,2}}[index][index];
21        printf("thing: %i\n", thing);
22    }
23    return 0;
24}
25