blob: f0b9dba982d3ef3e4950cc0b421e2fca1356caf7 [file] [log] [blame]
Mon P Wangc6a38a42009-07-22 03:08:17 +00001// RUN: clang-cc -emit-llvm < %s -o %t &&
2// RUN: grep addrspace\(1\) %t | count 8 &&
3// RUN: grep addrspace\(2\) %t | count 8
4
5// Check that we don't lose the address space when accessing an array element
6// inside a structure.
7
8#define __addr1 __attribute__((address_space(1)))
9#define __addr2 __attribute__((address_space(2)))
10
11typedef struct S {
12 int arr[ 3 ];
13} S;
14
15void test_addrspace(__addr1 S* p1, __addr2 S*p2, int* val, int n) {
16 for (int i=0; i < 3; ++i) {
17 int t = val[i];
18 p1->arr[i] = p2->arr[i];
19 }
20}