diff options
Diffstat (limited to 'test/Sema/address_spaces.c')
-rw-r--r-- | test/Sema/address_spaces.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/test/Sema/address_spaces.c b/test/Sema/address_spaces.c index b79799f0230c4..d9d23edb3cf48 100644 --- a/test/Sema/address_spaces.c +++ b/test/Sema/address_spaces.c @@ -4,7 +4,11 @@ #define _AS2 __attribute__((address_space(2))) #define _AS3 __attribute__((address_space(3))) -void foo(_AS3 float *a) { +void bar(_AS2 int a); // expected-error {{parameter may not be qualified with an address space}} + +void foo(_AS3 float *a, + _AS1 float b) // expected-error {{parameter may not be qualified with an address space}} +{ _AS2 *x;// expected-warning {{type specifier missing, defaults to 'int'}} _AS1 float * _AS2 *B; @@ -15,7 +19,13 @@ void foo(_AS3 float *a) { _AS1 int array[5]; // expected-error {{automatic variable qualified with an address space}} _AS1 int arrarr[5][5]; // expected-error {{automatic variable qualified with an address space}} - *a = 5.0f; + __attribute__((address_space(-1))) int *_boundsA; // expected-error {{address space is negative}} + __attribute__((address_space(0xFFFFFF))) int *_boundsB; + __attribute__((address_space(0x1000000))) int *_boundsC; // expected-error {{address space is larger than the maximum supported}} + // chosen specifically to overflow 32 bits and come out reasonable + __attribute__((address_space(4294967500))) int *_boundsD; // expected-error {{address space is larger than the maximum supported}} + + *a = 5.0f + b; } struct _st { @@ -27,6 +37,6 @@ struct _st { __attribute__((address_space(256))) void * * const base = 0; void * get_0(void) { return base[0]; // expected-error {{illegal implicit cast between two pointers with different address spaces}} \ - expected-warning {{returning 'void __attribute__((address_space(256)))*' discards qualifiers, expected 'void *'}} + expected-warning {{returning 'void __attribute__((address_space(256))) *' discards qualifiers, expected 'void *'}} } |