annotate gcc/testsuite/gcc.dg/atomic-invalid.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Test __atomic routines for invalid memory model errors. This only needs
kono
parents:
diff changeset
2 to be tested on a single size. */
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-require-effective-target sync_int_long } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 #include <stddef.h>
kono
parents:
diff changeset
7 #include <stdbool.h>
kono
parents:
diff changeset
8
kono
parents:
diff changeset
9 int i, e, b;
kono
parents:
diff changeset
10 size_t s;
kono
parents:
diff changeset
11 bool x;
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 int
kono
parents:
diff changeset
14 main ()
kono
parents:
diff changeset
15 {
kono
parents:
diff changeset
16 __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_RELAXED, __ATOMIC_SEQ_CST); /* { dg-warning "failure memory model cannot be stronger" } */
kono
parents:
diff changeset
17 __atomic_compare_exchange_n (&i, &e, 1, 0, __ATOMIC_SEQ_CST, __ATOMIC_RELEASE); /* { dg-warning "invalid failure memory" } */
kono
parents:
diff changeset
18 __atomic_compare_exchange_n (&i, &e, 1, 1, __ATOMIC_SEQ_CST, __ATOMIC_ACQ_REL); /* { dg-warning "invalid failure memory" } */
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 __atomic_load_n (&i, __ATOMIC_RELEASE); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
21 __atomic_load_n (&i, __ATOMIC_ACQ_REL); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
22
kono
parents:
diff changeset
23 __atomic_store_n (&i, 1, __ATOMIC_ACQUIRE); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
24 __atomic_store_n (&i, 1, __ATOMIC_CONSUME); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
25 __atomic_store_n (&i, 1, __ATOMIC_ACQ_REL); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 i = __atomic_always_lock_free (s, NULL); /* { dg-error "non-constant argument" } */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 __atomic_load_n (&i, 44); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
30
kono
parents:
diff changeset
31 __atomic_clear (&x, __ATOMIC_CONSUME); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
32 __atomic_clear (&x, __ATOMIC_ACQUIRE); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
33
kono
parents:
diff changeset
34 __atomic_clear (&x, __ATOMIC_ACQ_REL); /* { dg-warning "invalid memory model" } */
kono
parents:
diff changeset
35
kono
parents:
diff changeset
36 }