Bill Wendling | 68fd608 | 2012-11-12 06:42:51 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s |
| 2 | // <rdar://problem/12415959> |
| 3 | |
| 4 | typedef unsigned int u_int32_t; |
| 5 | typedef u_int32_t uint32_t; |
| 6 | |
| 7 | typedef unsigned long long u_int64_t; |
| 8 | typedef u_int64_t uint64_t; |
| 9 | |
Bill Wendling | 5ece32e | 2012-11-12 22:01:56 +0000 | [diff] [blame] | 10 | struct S; |
| 11 | |
| 12 | int func(struct S *s) { |
Bill Wendling | ba541d3 | 2012-11-12 21:13:35 +0000 | [diff] [blame] | 13 | // Error out if size is > 32-bits. |
Bill Wendling | 68fd608 | 2012-11-12 06:42:51 +0000 | [diff] [blame] | 14 | uint32_t msr = 0x8b; |
| 15 | uint64_t val = 0; |
| 16 | __asm__ volatile("wrmsr" |
| 17 | : |
| 18 | : "c" (msr), |
| 19 | "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}} |
| 20 | "d" (((val >> 32) & 0xFFFFFFFFUL))); |
Bill Wendling | ba541d3 | 2012-11-12 21:13:35 +0000 | [diff] [blame] | 21 | |
| 22 | // Don't error out if the size of the destination is <= 32 bits. |
| 23 | unsigned char data; |
| 24 | unsigned int port; |
| 25 | __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected. |
Bill Wendling | 5ece32e | 2012-11-12 22:01:56 +0000 | [diff] [blame] | 26 | |
| 27 | // Don't error out for incomplete types. |
| 28 | __asm(""::"a"(*s)); // No error expected. |
Bill Wendling | 68fd608 | 2012-11-12 06:42:51 +0000 | [diff] [blame] | 29 | } |