Mon P Wang | c6a38a4 | 2009-07-22 03:08:17 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -emit-llvm < %s -o %t && |
| 2 | // RUN: grep addrspace\(1\) %t | count 9 && |
| 3 | // RUN: grep addrspace\(2\) %t | count 9 |
| 4 | |
| 5 | // Check that we don't lose the address space when accessing a member |
| 6 | // of a structure. |
| 7 | |
| 8 | #define __addr1 __attribute__((address_space(1))) |
| 9 | #define __addr2 __attribute__((address_space(2))) |
| 10 | |
| 11 | typedef struct S { |
| 12 | int a; |
| 13 | int b; |
| 14 | } S; |
| 15 | |
| 16 | void test_addrspace(__addr1 S* p1, __addr2 S*p2) { |
| 17 | // swap |
| 18 | p1->a = p2->b; |
| 19 | p1->b = p2->a; |
| 20 | } |