| 1 |
/* Test generic __atomic routines for various errors. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-require-effective-target sync_int_long } */ |
| 4 |
/* { dg-options "-ansi" } */ |
| 5 |
|
| 6 |
void f1 (void* p) |
| 7 |
{ |
| 8 |
__atomic_compare_exchange(p, p, p, 0, 0, 0); /* { dg-error "must be a non-void pointer type" } */ |
| 9 |
} |
| 10 |
|
| 11 |
void f2 (int n) |
| 12 |
{ |
| 13 |
int a[n], b[n]; |
| 14 |
__atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer to a constant size" } */ |
| 15 |
} |
| 16 |
|
| 17 |
struct s { }; |
| 18 |
void f3 (void) |
| 19 |
{ |
| 20 |
struct s a,b; |
| 21 |
__atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer to a nonzero size" } */ |
| 22 |
} |
| 23 |
|
| 24 |
void f4 (int a, int b, int c) |
| 25 |
{ |
| 26 |
__atomic_load (&a, &b, &c, __ATOMIC_SEQ_CST); /* { dg-error "incorrect number of arguments" } */ |
| 27 |
} |
| 28 |
|
| 29 |
void f5 (int a, int b) |
| 30 |
{ |
| 31 |
__atomic_load (&a, b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer type" } */ |
| 32 |
} |
| 33 |
|
| 34 |
void f6 (int a, char b) |
| 35 |
{ |
| 36 |
__atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "size mismatch in argument" } */ |
| 37 |
} |
| 38 |
|
| 39 |
void f7 (int a, int b) |
| 40 |
{ |
| 41 |
__atomic_load (&a, &b, 45); /* { dg-warning "invalid memory model argument" } */ |
| 42 |
} |
| 43 |
|
| 44 |
void f8 (int a, int b, float c) |
| 45 |
{ |
| 46 |
__atomic_load (&a, &b, c); /* { dg-error "non-integer memory model argument" } */ |
| 47 |
} |