Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/atomic-26.f90

raw
1 ! { dg-do compile }
2
3 module m
4 implicit none
5 integer x
6 real d
7
8 contains
9
10 real function foo (y, e, f)
11 integer :: y
12 real v, e
13 real(8) :: f
14 !$omp atomic compare compare ! { dg-error "Duplicated 'compare' clause" }
15 if (x == y) x = d
16 !$omp atomic compare fail(seq_cst) fail(seq_cst) ! { dg-error "Duplicated 'fail' clause" }
17 if (x == y) x = d
18 !$omp atomic compare,fail(seq_cst),fail(relaxed) ! { dg-error "Duplicated 'fail' clause" }
19 if (x == y) x = d
20 !$omp atomic compare weak weak ! { dg-error "Duplicated 'weak' clause" }
21 if (x == y) x = d
22 !$omp atomic read capture ! { dg-error "CAPTURE clause is incompatible with READ or WRITE" }
23 v = d
24 !$omp atomic capture, write ! { dg-error "CAPTURE clause is incompatible with READ or WRITE" }
25 d = v; v = v + 1 ! { dg-error "Unexpected ..OMP ATOMIC statement" "" { target *-*-* } .-1 }
26 foo = v
27 end
28
29 real function bar (y, e, f)
30 integer :: y
31 real v, e
32 real(8) :: f
33 !$omp atomic read compare ! { dg-error "COMPARE clause is incompatible with READ or WRITE" }
34 if (x == y) x = d
35 !$omp atomic compare, write ! { dg-error "COMPARE clause is incompatible with READ or WRITE" }
36 if (x == y) x = d
37 !$omp atomic read fail(seq_cst) ! { dg-error "FAIL clause is incompatible with READ or WRITE" }
38 v = d
39 !$omp atomic fail(relaxed), write ! { dg-error "FAIL clause is incompatible with READ or WRITE" }
40 d = v
41 !$omp atomic fail(relaxed) update ! { dg-error "FAIL clause requires either the COMPARE clause or using the intrinsic MIN/MAX procedure" }
42 d = d + 3.0
43 !$omp atomic fail(relaxed) ! { dg-error "FAIL clause requires either the COMPARE clause or using the intrinsic MIN/MAX procedure" }
44 d = d + 3.0
45 !$omp atomic capture fail(relaxed) ! { dg-error "FAIL clause requires either the COMPARE clause or using the intrinsic MIN/MAX procedure" }
46 v = d; d = d + 3.0
47 !$omp atomic read weak ! { dg-error "WEAK clause requires COMPARE clause" }
48 v = d
49 !$omp atomic weak, write ! { dg-error "WEAK clause requires COMPARE clause" }
50 d = v
51 !$omp atomic weak update ! { dg-error "WEAK clause requires COMPARE clause" }
52 d = d + 3.0
53 !$omp atomic weak ! { dg-error "WEAK clause requires COMPARE clause" }
54 d = d + 3.0
55 !$omp atomic capture weak ! { dg-error "WEAK clause requires COMPARE clause" }
56 d = d + 3.0; v = d
57 !$omp atomic capture
58 d = d + 3.0; v = x ! { dg-error "capture statement reads from different variable than update statement writes" }
59 !$omp atomic compare fail ! { dg-error "Expected '\\\(' after 'fail'" }
60 if (x == y) x = d
61 !$omp atomic compare fail( ! { dg-error "Expected SEQ_CST, ACQUIRE or RELAXED" }
62 if (x == y) x = d
63 !$omp atomic compare fail() ! { dg-error "Expected SEQ_CST, ACQUIRE or RELAXED" }
64 if (x == y) x = d
65 !$omp atomic compare fail(foobar) ! { dg-error "Expected SEQ_CST, ACQUIRE or RELAXED" }
66 if (x == y) x = d
67 !$omp atomic compare fail(acq_rel) ! { dg-error "Expected SEQ_CST, ACQUIRE or RELAXED" }
68 if (x == y) x = d
69 !$omp atomic compare fail(release) ! { dg-error "Expected SEQ_CST, ACQUIRE or RELAXED" }
70 if (x == y) x = d
71 !$omp atomic compare fail(seq_cst ! { dg-error "Failed to match clause" }
72 if (x == y) x = d
73 bar = v
74 end
75
76 subroutine foobar
77 implicit none
78 integer :: i, j, k
79
80 !$omp atomic compare write ! { dg-error "COMPARE clause is incompatible with READ or WRITE" }
81 if (i == 1) i = 5
82
83 !$omp atomic compare
84 if (k == 5) i = 7 ! { dg-error "For !.OMP ATOMIC COMPARE, the first operand in comparison at .1. must be the variable 'i' that the update statement writes into at .2." }
85
86 !$omp atomic compare
87 if (j == i) i = 8 ! { dg-error "For !.OMP ATOMIC COMPARE, the first operand in comparison at .1. must be the variable 'i' that the update statement writes into at .2." }
88
89 !$omp atomic compare
90 if (i == 5) i = 8
91
92 !$omp atomic compare
93 if (5 == i) i = 8 ! { dg-error "Expected scalar intrinsic variable at .1. in atomic comparison" }
94
95 !$omp atomic compare
96 if (i == 5) i = i + 8 ! { dg-error "20: expr in !.OMP ATOMIC COMPARE assignment var = expr must be scalar and cannot reference var" }
97
98 end subroutine
99 end module