blob: d258f614e6448948c7603b259667866a8fc0cd51 [file] [log] [blame]
Mon P Wangc6a38a42009-07-22 03:08:17 +00001// RUN: clang-cc -emit-llvm < %s -o %t &&
2// RUN: grep addrspace\(2\) %t | count 4
3// RUN: grep addrspace\(3\) %t | count 4
4
5// Check the load and store are using the correct address space to access
6// the variables.
7
8#define __addr1 __attribute__((address_space(1)))
9#define __addr2 __attribute__((address_space(2)))
10#define __addr3 __attribute__((address_space(3)))
11
12typedef struct Pair {
13 __addr2 int* a;
14 __addr3 int* b;
15} Pair;
16
17typedef struct S {
18 Pair arr[ 3 ];
19} S;
20
21void test_addrspace(__addr1 S* p1, __addr1 S* p2) {
22 *p1->arr[0].a = *p2->arr[1].b;
23}