]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/atomic-pr51256.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / atomic-pr51256.c
CommitLineData
c466c4ff
AM
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
6void 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
11void 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
17struct s { };
18void 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
24void 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
29void f5 (int a, int b)
30{
31 __atomic_load (&a, b, __ATOMIC_SEQ_CST); /* { dg-error "must be a pointer type" } */
32}
33
34void f6 (int a, char b)
35{
36 __atomic_load (&a, &b, __ATOMIC_SEQ_CST); /* { dg-error "size mismatch in argument" } */
37}
38
39void f7 (int a, int b)
40{
41 __atomic_load (&a, &b, 45); /* { dg-warning "invalid memory model argument" } */
42}
43
44void f8 (int a, int b, float c)
45{
46 __atomic_load (&a, &b, c); /* { dg-error "non-integer memory model argument" } */
47}