blob: 8b09d57b3873c01cba66e83a5560c38fe43aa62c [file] [log] [blame]
// RUN: clang-cc -emit-llvm < %s -o %t &&
// RUN: grep addrspace\(1\) %t | count 8 &&
// RUN: grep addrspace\(2\) %t | count 9
// Check that we don't lose the address space when accessing an array element
// inside a structure.
#define __addr1 __attribute__((address_space(1)))
#define __addr2 __attribute__((address_space(2)))
typedef struct S {
int arr[ 3 ];
} S;
void test_addrspace(__addr1 S* p1, __addr2 S*p2, int* val, int n) {
for (int i=0; i < 3; ++i) {
int t = val[i];
p1->arr[i] = t;
for (int j=0; j < n; ++j)
p2[j].arr[i] = t;
}
}